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 2325
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.connection("localhost","root","abcdefgh ","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.OperationalError, e: if e.args[ 0 ] in ( 2006, 2013 ): # SERVER_GONE or SERVER_LOST error print 'reconnecting because of', e
db = MySQLdb.connection("localhost","root","","testing" ) db.query("""select dependency from assets where name = 'Java' """)
r = db.store_result()
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.connection("localhost","root","abcdefgh ","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.OperationalError, e: if e.args[ 0 ] in ( 2006, 2013 ): # SERVER_GONE or SERVER_LOST error print 'reconnecting because of', e
db = MySQLdb.connection("localhost","root","","testing" ) db.query("""select 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...
|
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...
|
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...
|
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:...
|
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...
|
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...
|
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...
|
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...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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,...
| |