[Openstack] Unable to connect to MYSQL DB using inbuilt session provided by openstack

Craig E. Ward cward at isi.edu
Fri Jun 7 17:07:03 UTC 2013


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

    mysql://user:password@server.domain/database

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
> engine=get_engine()
>
>
>
> This is inbuilt session info of Openstack :
>
> {'autocommit': True, 'autoflush': True, 'transaction': None,
> 'hash_key': 1L, 'expire_on_commit': False, '_new': {}, 'bind':
> Engine(sqlite:////opt/stack/nova/nova/openstack/common/db/nova.sqlite),
> '_deleted': {}, '_flushing': False, 'identity_map': {},
> '_enable_transaction_accounting': True, '_identity_cls': <class
> 'sqlalchemy.orm.identity.WeakInstanceDict'>, 'twophase': False,
> '_Session__binds': {}, '_query_cls': <class
> 'nova.openstack.common.db.sqlalchemy.session.Query'>}
>
>
>
> 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
> 'sqlalchemy.orm.query.Query'>}
>
>
> Please let me know how to proceed further.Any help is appreciated.
>
> Thanks,
> Swapnil


-- 
Craig E. Ward
USC Information Sciences Institute
cward at ISI.EDU






More information about the Openstack mailing list