Thans for your reply!
The OS I use is Ubuntu 16.04, and the Python Version is Python2.7.12( the 3.5.2 version is also installed by Ununtu, but the 2.7.12 version is defaulted).
Actually, I have followed these steps as yours, but I met the ERROR when I input the command "connection=pymonetdb.connect(username="monetdb",password="monetdb",hostname="127.0.0.1",database="testdb")".
Thanks for your help.
Best,
lingbin
At 2017-08-08 22:51:41, "Ying Zhang" <Y.Zhang@cwi.nl> wrote:
>Hai,
>
>It works for me (on macOS 10.12.6, with Jul2017 Mercurial source code):
>
>$ python2
>Python 2.7.13 (default, Mar 17 2017, 09:22:56)
>[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
>Type "help", "copyright", "credits" or "license" for more information.
>>>> import pymonetdb
>>>> connection=pymonetdb.connect(username="monetdb",password="monetdb",hostname="127.0.0.1",database="testdb")
>>>> cur=connection.cursor()
>>>> cur.execute("select * from tables")
>50
>>>> cur.fetchone()
>(2001, u'schemas', 2000, None, 10, True, 0, 0, 0)
>>>> cur.fetchone()
>(2007, u'types', 2000, None, 10, True, 0, 0, 0)
>>>> quit()
>
>$ pip list --format=columns | grep pymonetdb
>pymonetdb 1.0.5
>
>
>Can you tell us which OS you use, and the software versions?
>
>
>Regards,
>Jennie
>
>
>> On 8 Aug 2017, at 16:02, ÄßÁî±ó <lbni14@163.com> wrote:
>>
>> Hi,
>>
>>
>> I want to set up an API to MonetDBwith Python. I have followed the instructions£¨https://www.monetdb.org/Documentation/Manuals/SQLreference/Programming/Python£©and plan to make connection to my DB with this Python statement:
>> import pymonetdb;
>> connection=pymonetdb.connect(username="monetdb",password="monetdb",hostname="127.0.0.1",database="testdb")
>> But I got the following ERROR:
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "/home/lingbin/maizegenome/maizedbfarm/testpy/local/lib/python2.7/site-packages/pymonetdb/__init__.py", line 48, in connect
>> return Connection(*args, **kwargs)
>> File "/home/lingbin/maizegenome/maizedbfarm/testpy/local/lib/python2.7/site-packages/pymonetdb/sql/connections.py", line 55, in __init__
>> unix_socket=unix_socket, connect_timeout=connect_timeout)
>> File "/home/lingbin/maizegenome/maizedbfarm/testpy/local/lib/python2.7/site-packages/pymonetdb/mapi.py", line 139, in connect
>> self.socket.connect((hostname, port))
>> File "/usr/lib/python2.7/socket.py", line 228, in meth
>> return getattr(self._sock,name)(*args)
>> socket.error: [Errno 111] Connection refused
>>
>> Do you have a hint for me how to solve this error?
>>
>> Many thanks,
>>
>> Lingbin
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> users-list mailing list
>> users-list@monetdb.org
>> https://www.monetdb.org/mailman/listinfo/users-list
>
>_______________________________________________
>users-list mailing list
>users-list@monetdb.org
>https://www.monetdb.org/mailman/listinfo/users-list