Open GoogleCodeExporter opened 8 years ago
[deleted comment]
[deleted comment]
[deleted comment]
Please run the attached pypyodbc, it will print out the buffer of the encoded
unicode strings, so we can see how to decode the strings.
Please post the outputs and the exceptions.
Original comment by jiangwen...@gmail.com
on 25 Aug 2013 at 2:54
Attachments:
Hello I got the same issue trying to connect to a Oracle Database.
1.1.3 on Python 2.7, CentOS 6.4 64bits
Below the error:
In [2]: conect =
pypyodbc.connect('''Driver=FreeTDS;Server=10.1.1.1;port=1433;uid=user;pwd=pass;d
atabase=test''')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-bc4f1e15f4f6> in <module>()
----> 1 conect =
pypyodbc.connect('''Driver=FreeTDS;Server=10.1.1.1;port=1433;uid=user;pwd=pass;d
atabase=test''')
/tmp/pypyodbc.py in __init__(self, connectString, autocommit, ansi, timeout,
unicode_results, readonly, **kargs)
2287 check_success(self, ret)
2288
-> 2289 self.connect(connectString, autocommit, ansi, timeout,
unicode_results, readonly)
2290
2291
/tmp/pypyodbc.py in connect(self, connectString, autocommit, ansi, timeout,
unicode_results, readonly)
2335 else:
2336 ret = odbc_func(self.dbc_h, 0, c_connectString, len(self.connectString), None, 0, None, SQL_DRIVER_NOPROMPT)
-> 2337 check_success(self, ret)
2338
2339
/tmp/pypyodbc.py in check_success(ODBC_obj, ret)
953 ctrl_err(SQL_HANDLE_STMT, ODBC_obj.stmt_h, ret, ODBC_obj.ansi)
954 elif isinstance(ODBC_obj, Connection):
--> 955 ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi)
956 else:
957 ctrl_err(SQL_HANDLE_ENV, ODBC_obj, ret, False)
/tmp/pypyodbc.py in ctrl_err(ht, h, val_ret, ansi)
911 ret = ODBC_func(ht, h, number_errors, state, \
912 ADDR(NativeError), Message, 1024, ADDR(Buffer_len))
--> 913 debug = state.raw
914 print (debug)
915 if ret == SQL_NO_DATA_FOUND:
AttributeError: 'c_wchar_Array_36' object has no attribute 'raw'
Original comment by dan...@idev.com.br
on 2 Sep 2013 at 5:56
Issue 11 has been merged into this issue.
Original comment by jiangwen...@gmail.com
on 3 Sep 2013 at 11:35
I get exactly the same output as danilo@idev.com.br
Original comment by cyborg10...@gmail.com
on 3 Sep 2013 at 1:45
Using 1.1.6dev
In [2]: pypyodbc.version
Out[2]: '1.1.6dev'
In [3]: conect =
pypyodbc.connect('''Driver=FreeTDS;Server=10.1.1.1;port=1433;uid=user;pwd=pass;d
atabase=test''')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-bc4f1e15f4f6> in <module>()
----> 1 conect =
pypyodbc.connect('''Driver=FreeTDS;Server=10.1.1.1;port=1433;uid=user;pwd=pass;d
atabase=test''')
/tmp/pypyodbc.pyc in __init__(self, connectString, autocommit, ansi, timeout,
unicode_results, readonly, **kargs)
2287 check_success(self, ret)
2288
-> 2289 self.connect(connectString, autocommit, ansi, timeout,
unicode_results, readonly)
2290
2291
/tmp/pypyodbc.pyc in connect(self, connectString, autocommit, ansi, timeout,
unicode_results, readonly)
2335 else:
2336 ret = odbc_func(self.dbc_h, 0, c_connectString, len(self.connectString), None, 0, None, SQL_DRIVER_NOPROMPT)
-> 2337 check_success(self, ret)
2338
2339
/tmp/pypyodbc.pyc in check_success(ODBC_obj, ret)
953 ctrl_err(SQL_HANDLE_STMT, ODBC_obj.stmt_h, ret, ODBC_obj.ansi)
954 elif isinstance(ODBC_obj, Connection):
--> 955 ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi)
956 else:
957 ctrl_err(SQL_HANDLE_ENV, ODBC_obj, ret, False)
/tmp/pypyodbc.pyc in ctrl_err(ht, h, val_ret, ansi)
911 ret = ODBC_func(ht, h, number_errors, state, \
912 ADDR(NativeError), Message, 1024, ADDR(Buffer_len))
--> 913 debug = state.raw
914 print (debug)
915 if ret == SQL_NO_DATA_FOUND:
AttributeError: 'c_wchar_Array_36' object has no attribute 'raw'
Original comment by dan...@idev.com.br
on 3 Sep 2013 at 8:33
Dear all, please have a try with the attached pypyodbc.py
Original comment by jiangwen...@gmail.com
on 6 Sep 2013 at 3:57
Attachments:
Hello,
Don't return a error now but seems to be a infinite loop.
In [5]: conect =
pypyodbc.connect('''Driver=FreeTDS;Server=10.0.0.1;port=1433;uid=user;pwd=pass;d
atabase=MYDB''')
08S01
Original comment by dan...@idev.com.br
on 6 Sep 2013 at 1:06
Hi, the infinite loop should be fixed by this update. Please have a try.
Original comment by jiangwen...@gmail.com
on 6 Sep 2013 at 1:15
Attachments:
This revision works for me! Thanks. Will it be merged with the trunk?
Original comment by cyborg10...@gmail.com
on 6 Sep 2013 at 1:19
Yes, I will merge it after some more test and see other people's feed back.
You were testing the last version, right?
Original comment by jiangwen...@gmail.com
on 6 Sep 2013 at 1:25
I was using the version in comment 11
Original comment by cyborg10...@gmail.com
on 6 Sep 2013 at 1:28
Hello,
With last version is working, thanks!
Original comment by dan...@idev.com.br
on 6 Sep 2013 at 1:36
But I row name attributes aren't set.
For example:
cursor.execute("SELECT * FROM myTable WHERE 1;")
rows = cursor.fetchall()
for row in rows:
print row.id
AttributeError: 'Row' object has no attribute 'id'
Instead, I have to do
for row in rows:
print row[0]
1
2
3
4
5
..etc..
Original comment by cyborg10...@gmail.com
on 9 Sep 2013 at 8:29
This is not supported by pypyodbc, reason is explained here:
https://code.google.com/p/pypyodbc/issues/detail?id=10
In stead, pypyodbc offers row['id']
And, version 1.2.0 has been uploaded which contains the fix of this thread.
Original comment by jiangwen...@gmail.com
on 21 Sep 2013 at 11:16
Original issue reported on code.google.com by
hu...@kapsi.fi
on 20 Aug 2013 at 7:23