2
votes
2answers
583 views

set up a MySQLdb connection object for multiple databases

This question is likely noobish. Instead of hardcoding the MySQLdb connection object: e.g, db = MySQLdb.connect('localhost','name','pwrd','db_name') How do I set it up so I can specify the db_name ...
1
vote
1answer
176 views

How to access a database in Django but without ORM support

I have a second database in my Django application, which is filled with static data about the equivalent of zipcodes in my country (Brazil) and the related streets, neighborhoods, cities and states. ...
1
vote
3answers
2k views

Python and MySQL connection problems (mysqldb api)

I have config.ini: [mysql] host=localhost port=3306 user=root passwd=abcdefgh db=testdb unix_socket=/opt/lampp/var/mysql/mysql.sock I have this class: #!/usr/bin/python import MySQLdb,ConfigParser ...
1
vote
2answers
98 views

Update database with multiple SQL Statments

I am using mysql connector.Python 1.0.9 downloaded from MySQL site. I have a sample table here DROP TABLE IF EXISTS my_table; CREATE TABLE my_table (id INT NOT NULL AUTO_INCREMENT UNIQUE, Shot ...
1
vote
0answers
26 views

ImportError: No localization support for language 'eng' in python

i am getting ImportError: No localization support for language 'eng' when using MySQL Connector Python. My Traceback is as below. Traceback (most recent call last): File \"DB_Module.py\", line 151, ...
0
votes
2answers
533 views

MySQLdb with multiple transaction per connection

Is it okay to use a single MySQLdb connection for multiple transactions without closing the connection between them? In other words, something like this: conn = MySQLdb.connect(host="1.2.3.4", ...
0
votes
2answers
121 views

MySQL in Python; connection closes in for loop after first cycle

My MySQL connection closes after one loop cycle. I probably do something wrong in the usage of the mysql object. It outputs one cycle and then exits with an error. This is my code: cnx = ...
0
votes
2answers
119 views

Python MySQL connection argument error

I am trying to write a simple program to connect MySQL and perform some operations host = '10.0.106.40' user = 'ddddd' port = 3306 passwd = 'DDDDDD' db = 'bbbbbbb' ''' Creates a MySQL connection and ...
0
votes
1answer
130 views

Python MySQLdb connection - when to open/close new connections?

I'm using a few apps running Tornado Web server which all connect to a MySql DB using mysqldb. When I spin up the server, it instantiates a DB class (below) which opens a connection to the DB. All ...
0
votes
1answer
935 views

“Can't connect to MySQL server on 'localhost' (10061)” error in python

Just today I have decided that I wanted to learn python because I personally like the syntax and its feel. I am a pretty young developer and I really wanted to learn a new programming language since I ...