Comments (5)
can you post the full error log?
Original comment by [email protected]
on 16 Dec 2013 at 3:01
- Changed state: Started
from pypyodbc.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
<DirectorIT.Foundation.ExecutionCoordinator.ExecutionCoordinator_Common.clECComm
on object at 0x00000000040250B8>
def purge_Database(self):
print('Purging database')
# call the database stored procedure to clean up the database
lCursor = self._GlobalDBConnection.cursor()
try:
# Must reserve space for the input/output parameters.
"""
@aDisplayMessage varchar(4000)
,@aReturnCode int
,@aLogMessageInfo varchar(4000)
,@aConfirm VARCHAR(50)
"""
displayMsg = ''
returnCode = 0
logMsgInfo = ''
confirm = 'PurgeAll'
# Call our SP to purge and start clean.
# lCursor.execute("{exec DirectorIT_Global.Planning.PurgeFulfillmentAndPick('{0}',{1},'{2}','{3}')}".format(displayMsg, returnCode, logMsgInfo, confirm))
lCursor.execute("{CALL Planning.PurgeFulfillmentAndPick(?,?,?,?)}",
(displayMsg, returnCode, logMsgInfo, confirm))
> lCursor.commit()
File
"C:\SPE\GII_2013_R1\40-AutomatedTests\IntegrationTests\Python\src\DirectorIT\Fou
ndation\ExecutionCoordinator\ExecutionCoordinator_Common.py", line 207
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypyodbc.Cursor object at 0x000000000402A9B0>
def commit(self):
> self.connection.commit()
File "C:\SPE\GII_2013_R1\40-AutomatedTests\PyDirector\TPP\pypyodbc.py", line
2191
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypyodbc.Connection object at 0x0000000004025438>
def commit(self):
if not self.connected:
raise ProgrammingError('HY000','Attempt to use a closed connection.')
ret = SQLEndTran(SQL_HANDLE_DBC, self.dbc_h, SQL_COMMIT)
if ret != SQL_SUCCESS:
> check_success(self, ret)
File "C:\SPE\GII_2013_R1\40-AutomatedTests\PyDirector\TPP\pypyodbc.py", line
2428
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ODBC_obj = <pypyodbc.Connection object at 0x0000000004025438>, ret = -1
def check_success(ODBC_obj, ret):
""" Validate return value, if not success, raise exceptions based on the handle """
if ret not in (SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA):
if isinstance(ODBC_obj, Cursor):
ctrl_err(SQL_HANDLE_STMT, ODBC_obj.stmt_h, ret, ODBC_obj.ansi)
elif isinstance(ODBC_obj, Connection):
> ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi)
File "C:\SPE\GII_2013_R1\40-AutomatedTests\PyDirector\TPP\pypyodbc.py", line 952
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
ht = 2, h = c_void_p(5303808), val_ret = -1, ansi = False
def ctrl_err(ht, h, val_ret, ansi):
"""Classify type of ODBC error from (type of handle, handle, return value)
, and raise with a list"""
if ansi:
state = create_buffer(22)
Message = create_buffer(1024*10)
ODBC_func = ODBC_API.SQLGetDiagRec
if py_v3:
raw_s = lambda s: bytes(s,'ascii')
else:
raw_s = str_8b
else:
state = create_buffer_u(22)
Message = create_buffer_u(1024*10)
ODBC_func = ODBC_API.SQLGetDiagRecW
raw_s = unicode
NativeError = ctypes.c_int()
Buffer_len = c_short()
err_list = []
number_errors = 1
while 1:
ret = ODBC_func(ht, h, number_errors, state, \
NativeError, Message, len(Message), ADDR(Buffer_len))
if ret == SQL_NO_DATA_FOUND:
#No more data, I can raise
#print(err_list[0][1])
> state = err_list[0][0]
E IndexError: list index out of range
File "C:\SPE\GII_2013_R1\40-AutomatedTests\PyDirector\TPP\pypyodbc.py", line 917
IndexError
-------------------------------
Here is how we setup our DB Object.
_DBCatalog = 'DirectorIT_Global'
_GlobalConnectString = 'DSN={};UID=sa;PWD=BOB'.format(_DBCatalog)
def __init__(self):
# This creates our MD Manager connection used for the rest of the test
self._GlobalDBConnection = pypyodbc.connect(self._GlobalConnectString)
Original comment by [email protected]
on 16 Dec 2013 at 4:16
from pypyodbc.
Can you print out the ret value in below code when error occours?
File "C:\SPE\GII_2013_R1\40-AutomatedTests\PyDirector\TPP\pypyodbc.py", line
2191
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypyodbc.Connection object at 0x0000000004025438>
def commit(self):
if not self.connected:
raise ProgrammingError('HY000','Attempt to use a closed connection.')
ret = SQLEndTran(SQL_HANDLE_DBC, self.dbc_h, SQL_COMMIT)
if ret != SQL_SUCCESS:
> check_success(self, ret)
Original comment by [email protected]
on 17 Dec 2013 at 3:26
from pypyodbc.
Any resolution or work-around for this? I am having the same issue.
Original comment by [email protected]
on 3 Feb 2014 at 7:33
from pypyodbc.
I never had it fixed in pypyodbc. My resolution was to let pypyodbc handle
transaction, not the sp.
Original comment by [email protected]
on 3 Feb 2014 at 7:36
from pypyodbc.
Related Issues (20)
- Description attribute returns only first char of name (as byte) using Oracle ODBC & Linux HOT 2
- Trimmed varchar results.
- Column names get wonky on 64-bit system using iSeries DB2 driver HOT 3
- Oracle and Decimal_cvt issue
- IronPython 2.7 StopIteration exception raised when retrieving SQL data set
- "invalid literal" exceptions querying empty numeric fields when using LinuxODBC with FreeTDS
- use mbdtools,chinese character encoded by gb charset can't access correctly
- Passing datetime.date returns TypeError: Wrong Type HOT 2
- Mapping bigint in sqlserver 2008 into float, instead of int in python3
- Bad cursor description (mixed bytes and strings) on Ubuntu 14.04 HOT 2
- Row objects don't raise KeyError for invalid fields
- Data source name not found on linux + unixodbc + as400 iseries driver HOT 1
- Cannot access column names by attribute HOT 4
- pypyodbc doesn't support the MSSQL datetimeoffset column type.
- state = err_list[0][0] Index out of range
- UnicodeDecodeError because UTF-16 surrogate pairs are not handled HOT 1
- Enhancement: Support for lists as SQL parameters
- executemany is very slow
- Sage Line 100 Odbc connect KO HOT 1
- Not working on Windows 7 64 bit 3.4.3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pypyodbc.