I was messing around with the native ODBC module (I am using Python in
a Win32 environment), e.g:
import dbi, odbc
....and it seems to meet my needs. I'd rather use a module that comes
natively with Python if it works (don't care about performance in this
particular use case; just that it works).
The only issue I've had so far is retrieving data from Oracle when an
integer has been defined like:
number(p) [same thing as number(p,0) evidently]
This is from a database I didn't design and can't change. Evidently
there are new ways to declare integer data types in Oracle.
The problem is that the ODBC module suffixes an "L" to any integer
returned that
was defined as data type number(p). For example, an integer stored as:
56 will be returned as 56L. Actually, it now seems to be doing the
same thing, at least in some cases, for number data types declared as
number(p,s). What gives? Anyone know why this would happen?
Can't use mxODBC because it's a commercial product and can't use
cx_oracle at the moment because I am stuck with Python 2.1 (for ESRI
geoprocessing), and there is no cx_oracle for Python 2.1 (starts with
Python 2.2 and refuses to install for 2.1). I could install a later
version of Python independently, but I need to be able to do the
geoprocessing that 2.1 allows as well as ODBC calls to Oracle all in
the same script. This means dbi,odbc seems to be my only choice.
Thanks for the help so far y'all. As a former Perl devotee, I now
worship at the altar of Python. 5 1879 da*****@yahoo.c om wrote: I was messing around with the native ODBC module (I am using Python in a Win32 environment), e.g:
import dbi, odbc
...and it seems to meet my needs. I'd rather use a module that comes natively with Python if it works (don't care about performance in this particular use case; just that it works).
The only issue I've had so far is retrieving data from Oracle when an integer has been defined like:
number(p) [same thing as number(p,0) evidently]
This is from a database I didn't design and can't change. Evidently there are new ways to declare integer data types in Oracle.
The problem is that the ODBC module suffixes an "L" to any integer returned that was defined as data type number(p). For example, an integer stored as: 56 will be returned as 56L. Actually, it now seems to be doing the same thing, at least in some cases, for number data types declared as number(p,s). What gives? Anyone know why this would happen?
Well, it is a legal python umber literal. Fire up your python interpreter
and do long(1)
1L
It simply says that it is a long, not an int (which means 64 rather than 32
bits of precision I think)
So - no need to worry.
Diez
Great, thanks Diez! Should I just use str(n) to convert it to a format
I can write out to a flat file? I'm also struggling with the strange
date object format that the ODBC module returns when I fetch rows. I
need to convert that to a text string in a format that a mainframe
flatfile database requires. Any advice there?
Diez B. Roggisch wrote: da*****@yahoo.c om wrote:
I was messing around with the native ODBC module (I am using Python in a Win32 environment), e.g:
import dbi, odbc
...and it seems to meet my needs. I'd rather use a module that comes natively with Python if it works (don't care about performance in this particular use case; just that it works).
The only issue I've had so far is retrieving data from Oracle when an integer has been defined like:
number(p) [same thing as number(p,0) evidently]
This is from a database I didn't design and can't change. Evidently there are new ways to declare integer data types in Oracle.
The problem is that the ODBC module suffixes an "L" to any integer returned that was defined as data type number(p). For example, an integer stored as: 56 will be returned as 56L. Actually, it now seems to be doing the same thing, at least in some cases, for number data types declared as number(p,s). What gives? Anyone know why this would happen?
Well, it is a legal python umber literal. Fire up your python interpreter and do
long(1)
1L
It simply says that it is a long, not an int (which means 64 rather than 32 bits of precision I think)
So - no need to worry.
Diez da*****@yahoo.c om wrote: Great, thanks Diez! Should I just use str(n) to convert it to a format I can write out to a flat file? I'm also struggling with the strange
I guess so, yes.
date object format that the ODBC module returns when I fetch rows. I need to convert that to a text string in a format that a mainframe flatfile database requires. Any advice there?
No, I do use cx_Oracle - no strange dateformats there.
Diez
[posted & mailed] da*****@yahoo.c om wrote: The only issue I've had so far is retrieving data from Oracle when an integer has been defined like:
number(p) [same thing as number(p,0) evidently]
This is from a database I didn't design and can't change. Evidently there are new ways to declare integer data types in Oracle.
The problem is that the ODBC module suffixes an "L" to any integer returned that was defined as data type number(p). For example, an integer stored as: 56 will be returned as 56L. Actually, it now seems to be doing the same thing, at least in some cases, for number data types declared as number(p,s). What gives? Anyone know why this would happen?
The 'L' suffix indicates a Python long, which is an arbitrary precision
integer. If you're confident that the number in question is in the
normal integer range, you can coerce it to a normal int with int(p) so
the formatting on display doesn't include the suffix - if the number
is too large to coerce an OverflowError will be raised (for 2.2 and
earlier at least; 2.4 and later unify ints and longs).
Can't use mxODBC because it's a commercial product and can't use cx_oracle at the moment because I am stuck with Python 2.1 (for ESRI geoprocessing), and there is no cx_oracle for Python 2.1 (starts with Python 2.2 and refuses to install for 2.1). I could install a later version of Python independently, but I need to be able to do the geoprocessing that 2.1 allows as well as ODBC calls to Oracle all in the same script. This means dbi,odbc seems to be my only choice.
If you have access to a compiler, you may be able to build cx_Oracle
for Python 2.1, but you would have to check that the code doesn't
require Python 2.2 or later features. The MingW gcc package should
work with
Python 2.1 (which was built with VC6 as I recall).
I've been bugging ESRI about upgrading, and I'm sure others have too.
-------------------------------------------------------------------------
Andrew I MacIntyre "These thoughts are mine alone..."
E-mail: an*****@bullsey e.apana.org.au (pref) | Snail: PO Box 370 an*****@pcug.or g.au (alt) | Belconnen ACT 2616
Web: http://www.andymac.org/ | Australia
Thanks Andrew. I've been bugging ESRI about upgrading, and I'm sure others have too.
The beta of ArcGIS Desktop 9.2 ships with Python 2.4, so I imagine the
release of ArcGIS Desktop 9.2 this summer will also ship with Python
2.4. I've read threads recently on the geoprocessing / scripting
support.esri.co m of people using Python 2.4 successfully for
geoprocessing but I've not tried to install it yet.
Check out: http://forums.esri.com/Thread.asp?c=93&f=1729&t=157014
And also this support article: http://support.esri.com/index.cfm?fa...leShow&d=26872
Let me know if you have any luck with this.
Dana This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: eddie wang |
last post by:
Microsoft ODBC Driver 2.573 to retrieve Oracle Data, it is slow. How to
tune this? Thanks.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
|
by: SkunkDave |
last post by:
Is there a script anyone has that will automate the addition of an
access database to the OBDC datasources in control panel.
Thanks
|
by: Landley |
last post by:
Hi All,
Is there a method that I can call to return a list of available database
drivers?
If so, is there then a way to get the list of fields that are required for
those the database drivers?
L.
|
by: narasingarao |
last post by:
Hi to group,
I'm a student of M.C.A. from B.I.T. Ranchi...I'm in my project
period here i have to migrate the MS-Access database table to Oracle
data base tables...so, please help me in getting this....if possible
plz send me the sample code..
thanking you,
|
by: Adrian Schlesinger |
last post by:
Here is what happens (Windows 2000):
1. open the ODBC Data Source Administrator
2. go to the System DSN tab
3. then click Add - the Create Data Source screen pops up
4. select Microsoft Access Driver (*.mdb)
5. click Finish - the Create Data Source screen just disappears
The same happens if i select User DSN in step 2 or if i select any
other Access driver in step 4.
| |
by: Jean |
last post by:
Hi everyone,
I was hoping somebody could assist me in this issue. I am quite a
newbie to ODBC connections and was struggling to search for related
topics. Here is my situation:
I have a Access 2000 .mdb file which has several linked tables to a
ODBC data source, namely an Oracle back-end. I have already setup the
connctions to these back-end tables in the ODBC Administrator, and it
works fine. When I view one of these tables for the...
|
by: Jozef |
last post by:
Hello,
Is there any way to automatically create an ODBC data source if it doesn't
already exist?
I'd like to deploy this program on workstations that I may not have access
to, and don't want to rely on the user for any technical expertise. Is
there any way to do that?
Thanks!
|
by: |
last post by:
Greetings All,
I'm trying to access a excel file using the odbc data adaptor but the tables arent showing up.
I can get connected to the excel file using the Wizard but when I go to do the odbc adaptor no tables show up in the query
wizard why is this?
TIA
|
by: Peter Hann |
last post by:
As far as I know VisualStudio contains a MS built-in data provider for accessing
Oracle databases.
Is this built-in MS data provider only in the "full" VisualStudio Edition or in the Express
edition as well ?
Can I download this built-in MS Data Provider for Oracle databases separately and/or
re-install it somehow again ?
Peter
|
by: Dom |
last post by:
Someone in a post mentioned the Oracle Data Provider. Can anyone tell
me about it? I'd like to know the following:
1. Is it much faster than OleDB?
2. Is it essentially the same approach, eg, new Connection, new
Command, set CommandText, ExecuteDataRead(), cursor through a
DataReader, and so on?
3. Is it something I just download from Oracle and then install? Is
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |