Is there an easy way (without downloading any plugins) to connect to a MySQL database in Python?
Also, what would be the difference from calling a PHP script to retrieve the data from the database and hand it over to Python and importing one of these third-parties plugins that requires some additional software in the server.
EDIT: the ...
Hi
I have a table with two columns:
column A column B
1 2
1 2
2 1
I want to return total of ones = 3 total of twos = 3
The best I can come up with is two queries like so:
SELECT sum(CASE WHEN columnA =1 THEN 1 ELSE 0 END )
+ sum(CASE WHEN columnB =1 THEN 1 ELSE 0 END )
SELECT su...
I am using Spring's JdbcDaoSupport class with a DriverManagerDataSource using the MySQL Connector/J 5.0 driver (driverClassName=com.mysql.jdbc.driver). allowMultiQueries is set to true in the url.
My application is an in-house tool we recently developed that executes sql scripts in a directory one-by-one (allows us to re-create our sche...
My program has two threads:
Main execution thread that handles user input and queues up database writes
A utility thread that wakes up every second and flushes the writes to the database
Inside the main thread, I occasionally need to make reads on the database. When this happens, performance is not important, but correctness is. (I...
I want to add an additional value into an array before passing it to json_encode function,
but I can't get the syntax right.
$result = db_query($query);
// $row is a database query result resource
while ($row = db_fetch_object($result)) {
$stack[] = $row;
// I am trying to 'inject' array element here
$stack[...
I'm trying to search multiple fields (zc_city, zc_zip and zc_state), matching against a single value input by the user. The three columns should be included in the results. Here's what I have now:
$q = strtolower($_GET["q"]);
if (!$q) return;
$sql = "SELECT DISTINCT zc_city AS zcity FROM search_zipcodes WHERE zc_city LIKE '$q%'";
$rsd...
Hi there,
I am having major trouble connecting to my database via ODBC.
The db is local (but I have a mirror on a virtual machine), so I am trying to use the connectionstring:
Dsn=MonetDB;host=TARBELL
where TARBELL is the name of my computer. However, it doesn't connect. BUT, this string does:
Dsn=MonetDB;host=localhost
...
I have a field as follows in MySQL:
Type: Text
Length: 0
Decimals: 0
And when I try to insert data around the size of 4 pages of MS Word, Coldfusion errors with: Data Too Long from the DB.
I thought TEXT data type was able to expand and handle this size of data? What am I missing and what can I do?
...
Wanted to get started with Ruby on Rails so I installed instant rails and set up a mysql password. Problem is now I can't get access to phpmyadmin.
From the rails control panel, when I go to configure >> database (via PhpMyadmin) it opens up phpmyadmin with the message
Error
MySQL said: Documentation
#1045 - Access denied for user 'r...
Just getting into SQL stored queries right now... anyway, here's my database schema (simplified for YOUR convenience):
member
------
id INT PK
board
------
id INT PK
officer
------
id INT PK
If you're into OOP, Officer Inherits Board Inherits Member. In other words, if someone is listed on the officer table, s/he is listed on the b...
Hello,
The simple query below is not working. Any idea why? When I echo the three variables, the correct values are returned, so I know I have variables.
Thanks in advance,
John
$comment = $_POST['comment'];
$uid = $_POST['uid'];
$subid = $_POST['submissionid'];
echo $comment;
echo $uid;
echo $subid;
mysql_connect("mysqlv12", ...
I am working on a system for reserving seats. A user inputs how many seats they wish to reserve and the database will return a set of suggested seats that are not previously reserved that matches the number of seats being reserved.
For instance if I had the table:
SeatID | Reserved
-----------------
1 | false
2 | true
3 ...
When im inserting to the database on my dev server the text goes in fine, for example "that's" is "that's" in the db.
when uploading the exact same code to production server (hosted on a reseller account at bluehost) "that's" becomes "that\'s",
im not double escaping, its exactly the same code, what could be the issue here?
...
How to get the size of a record in MySql if the table contains fields of type TEXT or BLOB?
is it possible to get the size of a record or table using sql statement?
...
Hi all,
I have this query:
SELECT DISTINCT brand_name FROM masterdata WHERE in_stock = '1' ORDER BY brand_name
It works well, except that I get far too many results. How do I limit this such that rather than just looking for distinct entries, it will only give me distinct entries that exist a minimum of 3 times (for example)?
Basica...
Hi, Should be a simple one.
Database is mydb. One of the columns is mydata.
What SELECT query do I need in order to select the top 3 occurring results from mydata, but sorted alphabetically?
For example, if my data is this:
mydata
======
kilo (x 1 occurrence)
lima (x 9 occurrences)
golf (x 5 occurrences)
echo (x 9 occurrences)
zulu (...
I am trying to add a foreign key constraint via sqlyog, and getting this error, although I am only select one source and one reference columns
please select equal number of source
and reference
Does anyone knows what it means in this case? Note that I do have an equal number of source and reference columns...
...
Hello my Dear friends!
Firstly sorry to my English I am not an expert:)
I am using freeradius 2.1.7 and MySQL instaled on Ubuntu server 9.04.
Now, the perl script called: "auth.pl" is verifying usersnames, passwords, and updating information.
The problem is that on a certain number of connections simply "NAS" - Mikrotik
until the next ...
Hi,
I noticed that in MySQL, both VARCHAR and TEXT offer variable-sized data. Well, VARCHAR is a bit more efficient in data storage, but still, TEXT MEDIUMTEXT and LONGTEXT offer a lot more potential. So, what are the real uses of VARCHAR?
...
I have been working with Subversion for a while now, and it's been incredible for the management of my projects, and even to help managing the deployment to several different servers, but there is just the one thing that still annoys me. Whenever I make any changes to the database structure, I need to update every server manually, I have...