← Back to team overview

openstack team mailing list archive

Re: Unable to connect to MYSQL DB using inbuilt session provided by openstack


What is the setting of the sql_connection variable in nova.conf? Can you use the regular mysql client to connect using the data in the connection string?

A connection string


would become

   mysql -h server.domain -u user -ppassword database

on the command line. If that fails, the reported error will indicate what you should do next.

On 06/07/2013 02:04 AM, swapnil khanapurkar wrote:
Hi All,

I want to use the existing engine created by Openstack to connect to
the MYSQL Database, however somehow I am not able to connect. .

The existing engine gets connected to SQLite database(which is the
default db) and not MYSQL.

I got the Openstack session and engine from :
from nova.openstack.common.db.sqlalchemy import session as db_session

get_session = db_session.get_session
session = get_session()

get_engine = db_session.get_engine

This is inbuilt session info of Openstack :

{'autocommit': True, 'autoflush': True, 'transaction': None,
'hash_key': 1L, 'expire_on_commit': False, '_new': {}, 'bind':
'_deleted': {}, '_flushing': False, 'identity_map': {},
'_enable_transaction_accounting': True, '_identity_cls': <class
'sqlalchemy.orm.identity.WeakInstanceDict'>, 'twophase': False,
'_Session__binds': {}, '_query_cls': <class

Then Manully created session and engine and able to connect to db and query it
The Manualy created session info is:

{'autocommit': False, 'autoflush': True, 'transaction':
<sqlalchemy.orm.session.SessionTransaction object at 0xa2fe34c>,
'hash_key': 1L, 'expire_on_commit': True, '_new': {}, 'bind':
Engine(mysql://username:passworsd@hostip/nova), '_deleted': {},
'_flushing': False, 'identity_map': {},
'_enable_transaction_accounting': True, '_identity_cls': <class
'sqlalchemy.orm.identity.WeakInstanceDict'>, 'twophase': False,
'_Session__binds': {}, '_query_cls': <class

Please let me know how to proceed further.Any help is appreciated.


Craig E. Ward
USC Information Sciences Institute