Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Sharing database connection from C to Python

Reply
Thread Tools

Sharing database connection from C to Python

 
 
dgiagio@gmail.com
Guest
Posts: n/a
 
      01-30-2006
Hi,

I'm developing an application using the C language and Python for it's
plugins. The C program connects to a MySQL database and keeps that
connection active. Is it possible to 'share' this connection with the
Python plugins? If so, is there a "standard" way to do that?

Thank you.

DG

 
Reply With Quote
 
 
 
 
Daniel Dittmar
Guest
Posts: n/a
 
      02-01-2006
wrote:
> I'm developing an application using the C language and Python for it's
> plugins. The C program connects to a MySQL database and keeps that
> connection active. Is it possible to 'share' this connection with the
> Python plugins? If so, is there a "standard" way to do that?


There is no simple way as MySQL connections in Python are Python
extension objects. You'll probably have to use a custom MySQL driver.

Either create the session in C and add a constructor to the python to
create a MySQL connection object from that handle or pointer

Or add a method to the Python MySQL object to get the handle and
pointer. Create all database connections in Python (precise: using the
Python API from C), get the handle and pointer to use it from C, pass
the original session to plugins.

Daniel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Sharing a DBI::Mysql database connection with your children Andrew DeFaria Perl Misc 7 04-01-2008 11:01 PM
Sharing database connection with controls Mike P2 ASP .Net 4 06-03-2007 02:29 PM
Database connection sharing Atif Jalal ASP .Net 1 08-08-2003 09:18 PM



Advertisments