Hello!
Trying to fetch long varchar2 column and get the following error:
cx_Oracle.Datab aseError: column at array pos 0 fetched with error: 1406
i.e. string buffer is not much enough to fetch the string.
# fragment of code...
myCon = cx_Oracle.conne ct(user, psw, dsn)
myCur = myCon.cursor()
myCur.execute(" ""
select COLUMN from TABLE where ID=1
""")
for record in myCur.fetchall( ):
# ...
Error is reproduced only if actual string value longer than half of
declared column size. For short strings all is ok.
If I print myCur.descripti on, I get:
[('COLUMN', <type 'cx_Oracle.STRI NG'>, 250, 250, 0, 0, 1)]
250 - declared column max size, but I guess cx_Oracle allocates only 250
bytes(!), so if my string longer than 125 chars (utf-8 national char
occupies > 1 byte) - I get the error.
Is it bug or what? Any suggestions?
Extra info:
OS - SuSE Linux 9.2
Client - Oracle Client 9.2.0.1.0
NLS_LANG="RUSSI AN_CIS.UTF8"
--
Best regards, Maxim Kuleshov 1 4433
Maxim Kuleshov wrote: Hello!
Trying to fetch long varchar2 column and get the following error:
cx_Oracle.Datab aseError: column at array pos 0 fetched with error:
1406 i.e. string buffer is not much enough to fetch the string.
# fragment of code... myCon = cx_Oracle.conne ct(user, psw, dsn) myCur = myCon.cursor() myCur.execute(" "" select COLUMN from TABLE where ID=1 """) for record in myCur.fetchall( ): # ...
Error is reproduced only if actual string value longer than half of declared column size. For short strings all is ok.
If I print myCur.descripti on, I get:
[('COLUMN', <type 'cx_Oracle.STRI NG'>, 250, 250, 0, 0, 1)]
250 - declared column max size, but I guess cx_Oracle allocates only
250 bytes(!), so if my string longer than 125 chars (utf-8 national char occupies > 1 byte) - I get the error.
Is it bug or what? Any suggestions?
Googling for "varchar2 utf-8" suggests that it's an Oracle's
feature (or issue). varchar2 is allocated in bytes. Finding
out the largest number of bytes per character is left as
an exercise :)
Sergey. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bryan J Gudorf |
last post by:
PDO, an open source python module for interfacing with RDBMS (SQL
databases), has now reached 1.2.0! PDO provides an object oriented API,
similar to that of ADO or JDBC, to python developers. PDO features column
access by name. This new release adds support for the cx_Oracle, DB2 and
adodbapi modules, allowing users to use PDO with a variety of database
systems. 9 different DBAPI modules are now supported, allowing for PDO to
be used...
|
by: vb_bv |
last post by:
Does Pyton PL/SQL programming language of Oracle support?
Thx
|
by: hot.favorite |
last post by:
Hi,
I'm fairly new to Python so please pardon any dumbness on my part.
I plan to write an app in Python that will run on Linux and would need
to connect to Oracle and MySQL. I could use MySQLdb for MySQL and
cx_oracle for Oracle, but 2 different APIs in the same app is kind of
painful.
So I have unixODBC that gives me ODBC on Linux. The best ODBC access
|
by: dananrg |
last post by:
I'm a little confused about what's out there for database modules at:
http://python.org/topics/database/modules.html
What I'd like to do is use Python to access an Oracle 9.X database for
exporting a series of tables into one aggregated table as a text file,
for import into a mainframe database. The catch is that I'd like to
write code that wouldn't need to be changed (much) if we switched from
Oracle to some other RDBMS (still need to...
|
by: cirudinezidane |
last post by:
Hi!!
I'd like to install Oracle 10 g express edition over Ubuntu to use with
Python 2.4. I have installed Ubuntu, Python 2.4 and Oracle database. I
think that I have installed correctly cx_Oracle because I have
cx_Oracle.so in /usr/share/python2.4/site-packages/ directory. My
environment variables are ORACLE_HOME=/usr/lib/oracle and
LD_LIBRARY_PATH=$ORACLE_HOME/lib. I am trying to connect to Oracle
database:
>>>import cx_Oracle
| |
by: Richard Schulman |
last post by:
Sorry to be back at the goodly well so soon, but...
....when I execute the following -- variable mean_eng_txt being
utf-16LE and its datatype nvarchar2(79) in Oracle:
cursor.execute("""INSERT INTO mean (mean_id,mean_eng_txt)
VALUES (:id,:mean)""",id=id,mean=mean)
I not surprisingly get this error message:
|
by: M.-A. Lemburg |
last post by:
On 2008-04-30 18:42, Sean Ryan wrote:
The -v option only causes Python to print more information to
stderr explaining where it is looking for modules.
You should be seeing any dynamic loader messages in both cases,
ie. when running with or without -v.
While it is possible that cx_Oracle does some extra processing
when running Python in -v mode, this is rather unlikely.
|
by: mh |
last post by:
I'm pleased to announce the initial release of OraPIG,
the Oracle Python Interface Generator.
OraPIG generates Python wrapper classes for Oracle packages.
If you use Oracle and Python, this might be a pretty useful
package for you. Download it and let us know what
you think!
Cheers,
|
by: Raja |
last post by:
Hi,
I am trying to write a cgi program which would be executed on
browser with Apache server installed.
The program would make a connection to a database using cx_Oracle
module and display results on page.
The code is working fine on the command line but when executing it on
the browser i get the famouse "Premature end of script headers" error.
|
by: harshakusam |
last post by:
Hi All,
In my python script i use to run some oracle queries for this i require a library to connect to oracle which is cx_Oracle.
When we were using 9i(oracle).. my script was running fine.. and now when we migrated to 10 G its giving problem...
Few lines of my script
import sys
import cx_Oracle
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
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...
| | |