473,549 Members | 3,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sharing database connection from C to Python

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

Jan 30 '06 #1
1 1493
dg*****@gmail.c om 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
Feb 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2774
by: Alex | last post by:
Hi all, I want to write a "File sharing system". Is posssible with socket and thread create multisuer connection at the same time ? or is wrong my idea?? thanks
6
5884
by: varlagas | last post by:
We disabled the antivirus software but the problem persists. Any clues? Many thanks in advance! Panagiotis Varlagas ======================================================================= 2005-07-28-10.39.02.015001 Instance:DB2 Node:000 PID:1568(db2syscs.exe) TID:2440 Appid:0A00153A.C90B.050728083720
1
1534
by: Atif Jalal | last post by:
How can I share the sane databse connection between asp.net pages. I also use objects(middleware), so can I pass the same DB connection when I instantiate the object by calling its constructor?
3
1991
by: grooby | last post by:
I would like to develop an asp.net Web application using muliple web projects under one solution file and share the session information between web applications( or projects). Is this possible?
4
1641
by: Mike P2 | last post by:
Hi. I'm writing controls that have to query the database, and it bothers me that I might have several of these controls on a page that each create, open, and close their own connection with the same connection string, and the page class has a connection object too. I'm using the code-behind way of doing things, and I considered leaving the...
4
3025
by: coldpizza | last post by:
Hi, I want to run a database query and then display the first 10 records on a web page. Then I want to be able to click the 'Next' link on the page to show the next 10 records, and so on. My question is how to implement paging, i.e. the 'Next/Prev' NN records without reestablishing a database connection every time I click Next/Prev? Is...
0
1709
by: Dom Rout | last post by:
Hello. Well, this is my first post on any USENET group anywhere, so I hope I get it right. Basically, I just want to get some opinions on a plan of mine for a new project. I want to produce a small, peer to peer, file sharing network for the use of myself and some of my friends. The purpose of this is basically to allow us to share files...
6
3719
by: Iain King | last post by:
Hi. I'm using the win32 module to access an Access database, but I'm running into the File Sharing lock count as in http://support.microsoft.com/kb/815281 The solution I'd like to use is the one where you can temporarily override the setting using (if we were in VB): DAO.DBEngine.SetOption dbmaxlocksperfile,15000 Can I do this in...
45
2976
by: =?Utf-8?B?QmV0aA==?= | last post by:
Hello. I'm trying to find another way to share an instance of an object with other classes. I started by passing the instance to the other class's constructor, like this: Friend Class clsData Private m_objSQLClient As clsSQLClient Private m_objUsers As clsUsers
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7718
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1936
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.