Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

connecting to AWS RDS instance fails #7

Closed
fevral13 opened this issue Feb 12, 2012 · 7 comments
Closed

connecting to AWS RDS instance fails #7

fevral13 opened this issue Feb 12, 2012 · 7 comments

Comments

@fevral13
Copy link

When I try to connect with ultramysql to Amazon's db instance, I get weird exception:

In [1]: import umysql

In [2]: conn = umysql.Connection()

In [3]: conn.connect('xxxxx.us-east-1.rds.amazonaws.com', 3306, 'xxxxx', 'xxxxx', 'xxxxx')
---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)
/home/fevral13/<ipython-input-3-213a95b4356f> in <module>()
----> 1 conn.connect('xxxxx.us-east-1.rds.amazonaws.com', 3306, 'xxxxx', 'xxxxx', 'xxxxx')

SystemError: error return without exception set

In [4]: conn.is_connected()
Out[4]: True

In [5]: conn.query('select 1')
---------------------------------------------------------------------------
Error                                     Traceback (most recent call last)
/home/fevral13/<ipython-input-5-4ec56317c561> in <module>()
----> 1 conn.query('select 1')

Error: (0, 'Connection reset by peer when receiving')

But when I use pymysql, for example, everything works:

In [6]: import pymysql

In [7]: c = pymysql.Connect(host='xxxxx.us-east-1.rds.amazonaws.com', port=3306, user='xxxxx', passwd='xxxxx', db='xxxxx')

In [8]: c.query('select 1')
Out[8]: 1

So the db is up and connectable

@fevral13
Copy link
Author

And no problem connecting to local mysql server:

In [1]: import umysql

In [2]: conn = umysql.Connection()

In [3]: conn.connect('localhost', 3306, 'root', '', '')

In [4]: conn.query('select 1')
Out[4]: <umysql.ResultSet at 0x2c66cc0>

@jskorpan
Copy link

Are you using gevent?

Den 12 februari 2012 11:27 skrev Serj Zavadsky <
reply@reply.github.com

:

When I try to connect with ultramysql to Amazon's db instance, I get weird
exception:

In [1]: import umysql

In [2]: conn = umysql.Connection()

In [3]: conn.connect('xxxxx.us-east-1.rds.amazonaws.com', 3306,
'xxxxx', 'xxxxx', 'xxxxx')


SystemError Traceback (most recent call
last)
/home/fevral13/ in ()
----> 1 conn.connect('xxxxx.us-east-1.rds.amazonaws.com', 3306,
'xxxxx', 'xxxxx', 'xxxxx')

SystemError: error return without exception set

In [4]: conn.is_connected()
Out[4]: True

In [5]: conn.query('select 1')


Error Traceback (most recent call
last)
/home/fevral13/ in ()
----> 1 conn.query('select 1')

Error: (0, 'Connection reset by peer when receiving')

But when I use pymysql, for example, everything works:

In [6]: import pymysql

In [7]: c = pymysql.Connect(host='xxxxx.us-east-1.rds.amazonaws.com',
port=3306, user='xxxxx', passwd='xxxxx', db='xxxxx')

In [8]: c.query('select 1')
Out[8]: 1

So the db is up and connectable


Reply to this email directly or view it on GitHub:
#7

Jonas Trnstrm
Product Manager
e-mail: jonas.tarnstrom@esn.me
skype: full name "Jonas Trnstrm"
phone: +46 (0)734 231 552

ESN Social Software AB
www.esn.me

@fevral13
Copy link
Author

Yes, I'm using ultramysql with gevent. Creating connection pool with gevent.queue.Queue:

DB_CONNECTION_POOL = 10
pool = Queue()
for i in xrange(DB_CONNECTION_POOL):
    c = Connection()
    c.connect(DATABASE_HOST, DATABASE_PORT, DATABASE_USER, DATABASE_PASSWORD, DATABASE_NAME)
    pool.put(c)

and using it:

    c = pool.get()
    result = c.query('query')
    pool.put(c)

everything works with local mysql server

@jskorpan
Copy link

Then there's something different with Amazon's db instances. If you can
spare a DB account for me I could probably have a look at it.

//JT

Den 13 februari 2012 12:20 skrev Serj Zavadsky <
reply@reply.github.com

:

Yes, I'm using ultramysql with gevent. Creating connection pool with
gevent.queue.Queue:

DB_CONNECTION_POOL = 10
pool = Queue()
for i in xrange(DB_CONNECTION_POOL):
c = Connection()
c.connect(DATABASE_HOST, DATABASE_PORT, DATABASE_USER,
DATABASE_PASSWORD, DATABASE_NAME)
pool.put(c)

and using it:

   c = pool.get()
   result = c.query('query')
   pool.put(c)

everything works with local mysql server


Reply to this email directly or view it on GitHub:
#7 (comment)

Jonas Trnstrm
Product Manager
e-mail: jonas.tarnstrom@esn.me
skype: full name "Jonas Trnstrm"
phone: +46 (0)734 231 552

ESN Social Software AB
www.esn.me

@fevral13
Copy link
Author

sent connection details to jonas.tarnstrom@esn.me

@jskorpan
Copy link

Hi,
Thanks for the assistance
I can connect now with the latest commit.

@fevral13
Copy link
Author

Hi, Jonas,

thank you very much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants