Hello,
I have query related to MySQL connectivity.
When we make a connection with MySQL and we don't use this connection for some particular amount of time (I don't know what) it automatically get disconnected. I don't want this thing to happen.
I remember one thing of MySQL that it provides a facility for this that whenever we make any connection with server a periodic acknowledgement singal is transferred between server & connection program, but I dont know how to use it.
Can you please help me out for this???
Thanks.
2 2342
Hello,
I have query related to MySQL connectivity.
When we make a connection with MySQL and we don't use this connection for some particular amount of time (I don't know what) it automatically get disconnected. I don't want this thing to happen.
I remember one thing of MySQL that it provides a facility for this that whenever we make any connection with server a periodic acknowledgement singal is transferred between server & connection program, but I dont know how to use it.
Can you please help me out for this???
Thanks.
Hi...
I got the answer...
Its here...
import MySQLdb
def MySqlSample(): """ Python2.4 to MySQL using mysql-python using ping().
""" # Establish a connection db=MySQLdb.conn ection("localho st","root","abc defgh","testing ") # Run a MySQL query from Python and get the result set try: db.ping() except ImportError: pass # No MySQLdb module installed. except AttributeError: pass # SQLite connections have not ping() method. except MySQLdb.Operati onalError, e: if e.args[ 0 ] in ( 2006, 2013 ): # SERVER_GONE or SERVER_LOST error print 'reconnecting because of', e
db = MySQLdb.connect ion("localhost" ,"root","","tes ting") db.query("""sel ect dependency from assets where name = 'Java' """)
r = db.store_result () bartonc 6,596
Recognized Expert Expert
Hi...
I got the answer...
Its here...
import MySQLdb
def MySqlSample(): """ Python2.4 to MySQL using mysql-python using ping().
""" # Establish a connection db=MySQLdb.conn ection("localho st","root","abc defgh","testing ") # Run a MySQL query from Python and get the result set try: db.ping() except ImportError: pass # No MySQLdb module installed. except AttributeError: pass # SQLite connections have not ping() method. except MySQLdb.Operati onalError, e: if e.args[ 0 ] in ( 2006, 2013 ): # SERVER_GONE or SERVER_LOST error print 'reconnecting because of', e
db = MySQLdb.connect ion("localhost" ,"root","","tes ting") db.query("""sel ect dependency from assets where name = 'Java' """)
r = db.store_result ()
There are many examples of MySQL connectivity in the Python > Code Forum.
You are welcome to check those out and post Python related questions in the Python Forum Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Maru, Mulugeta |
last post by:
Is there a turorial on MySQL/Python?
VisionTV proudly celebrates 15 years as Canada's multi-faith television network.
|
by: Gaz Oakley |
last post by:
Hi,
I've looked through the mailing list archives trying to find the best ways
of connecting to a MySQL database using Python. From what I've seen, people
seem to be using http://sourceforge.net/projects/mysql-python/. First of
all, is this the recommended method of connectivity? (I'm assuming it is).
If it is, I've experienced a problem here. I'd ideally like to have Python
2.3 installed with MySQLdb. Following the instructions on...
|
by: Dfenestr8 |
last post by:
Hi.
Been told by the admin of my (free!) server that he'd rather I should
learn to use mysql if I want to continue writing cgi scripts there.
Not even sure exactly what mysql is.
Is there a simple tutorial anywhere on the web about using python + mysql?
|
by: John Wells |
last post by:
Yes, I know you've seen the above subject before, so please be gentle with
the flamethrowers.
I'm preparing to enter a discussion with management at my company
regarding going forward as either a MySql shop or a Postgresql shop.
It's my opinion that we should be using PG, because of the full ACID
support, and the license involved. A consultant my company hired before
bringing me in is pushing hard for MySql, citing speed and community...
|
by: Jay |
last post by:
hi people
i am trying to connect to ppstgresql on a debian system using perl . i
am getting the following error .can any one please suggest what has to
be done
install_driver(pg) failed: Can't locate DBD/pg.pm in @INC (@INC
contains: /etc/perl /usr/local/lib/perl/5.8.3
/usr/local/share/perl/5.8.3 /usr/lib/perl5 /usr/share/perl5
/usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at
| |
by: TonyB |
last post by:
I'm running the zip'd version of PHP (PHP 5.1.2 zip package) downloaded
from here: http://www.php.net/downloads.php. PHP won't connect with
MySQL.
>From docs and threads, it seems enabling PHP/MySQL connectivity on a
Windows XP machine requires three configuration edits. These are:
1. In php.ini, enable php_mysql.dll by uncommenting
"extension=php_mysql.dll".
2. In php.ini, set "extension_dir" to the folder containing
|
by: sweety12345 |
last post by:
Hello friends,i am developing a forum . I am using jsp/servlets and MySQL as backend. I am inserting customer data in register form and generating customer id using autoincrementable.how to store the data in mysql when a user is registering in the form and how can i retrieve data from the database in the jsp web page.
|
by: healthsp |
last post by:
I have a JSP page where I will be entering data . On clicking the submit button,I want this data to go to the database. I want to do it through XML...
Any one please help me how to solve this issue...
|
by: swethak |
last post by:
hi,
when i run a java program for to store data and retrive using mysql datatabse i got the following errors.I think in that one of error is due to set the class path.I placed my mysql-connector-java-3.0.11-stable-bin jar in lib directory.What is the command to set a classpath in windows for java mysql connectivity.plz tell that .And also how i avoid these errors.
import java.sql.*;
import java.util.*;
import java.net.*;
import...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |