[GENERAL] pymssql: Problem with Unicode string

2011-01-29 Thread orgilhp
Hello!
I am using pymssql-1.9.908. And I have MSSQL2008 database server.
I ran following code from python 2.6:
---
import pymssql
conn = pymssql.connect(host='testserver', user='sa',
password='sa', database='testdb', as_dict=True)
crms = conn.cursor()
crms.execute('SELECT cc_Name FROM tblUsers')
for line in crms.fetchall():
print 'cc_Name:', self.unicodify(line['cc_Name'])
break
crms.close()
---
the result is- cc_Name: ?, ???
But the actual data is Аймаг, хот and I expect that the output would
be cc_Name: Аймаг, хот.

Here is my question:
How to get Unicode data from MSSQL database using pymssql library?

Any suggestion would be highly appreciated!
regards,
Orgil.D

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] pymssql Connection to the database failed for an unknown reason

2011-01-29 Thread orgilhp
Hello
I am using pymssql to connect to MSSQL2008 database. But an error
occurs:
--
 import pymssql
 conn = pymssql.connect(host='orgilhpnb\mssql2008', user='erp', 
 password='123', database='eoffice_clone')
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/pymodules/python2.6/pymssql.py, line 609, in connect
raise InterfaceError, e[0]
pymssql.InterfaceError: Connection to the database failed for an
unknown reason.
--

The host name, user, password and database name are all correct.
Why I get an error? Please help me!

Any suggestion would be highly appreciated!

Best regards,
Orgil

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Read problem from Bytea column

2011-01-23 Thread orgilhp
Thanks for your reply!


 Which version of Npgsql are you using?


I am using Npgsql2.0.11-bin-ms.net.

 Did you try another npgsql version? If it works in another version, please,
 fill a bug report so we can fix it.


I have not used another version yet!
But I think that 2.0 is the latest and has more capabilites version!
Is this right?


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[GENERAL] Read problem from Bytea column

2011-01-21 Thread orgilhp
Hello,
I have postgresql 8.3.9 database. Now I am working on reading file
from bytea data and save to filesystem.
I am using Npgsql.dll on c#.net.

First I have using OpenERP to upload a file to postgres database in
bytea column. The original file size is 104,960 bytes and .doc
extension.
Then I read the bytea data and save it to file system, its size
becomes 141,790 bytes. This file cannot be opened however its
extension is .doc.

What is going on?

My c# code is below:

 NpgsqlCommand cmd = new NpgsqlCommand(SELECT bytea_col
FROM TableTest LIMIT 1, Conn);
 using (FileStream stream = new FileStream(c:\test.doc,
FileMode.Create))
{
byte[] rawbytes = (byte[])cmd.ExecuteScalar();
stream.Write(rawbytes, 0, rawbytes.Length);
stream.Close();
}

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general