Showing entries 23171 to 23180 of 44965
« 10 Newer Entries | 10 Older Entries »
Easy Python: MySQL connection and iteration

If you’ve been looking for a simple python script to use with MySQL that you can use to expand upon for your next project, check this one out. It has error handling for the connection, error handling for the sql call, and loop iteration for the rows returned.

#!/usr/bin/python
import sys
import MySQLdb

my_host = "localhost"
my_user = "user"
my_pass = "password"
my_db = "test"

try:
    db = MySQLdb.connect(host=my_host, user=my_user, passwd=my_pass, db=my_db)
except MySQLdb.Error, e:
     print "Error %d: %s" % (e.args[0], e.args[1])
     sys.exit (1)

cursor = db.cursor()
sql = "select column1, column2 from table";
cursor.execute(sql)
results = cursor.fetchall()
for row in results:
    column1 = row[0]
    column2 = row[1]
    print "column1: %s, column2: %s"%(column1,column2)

db.close()
451 CAOS Links 2010.08.10

Compliance. Funding. Financial results. Copyright assignment. And more.

Follow 451 CAOS Links live @caostheory on Twitter and Identi.ca
“Tracking the open source news wires, so you don’t have to.”

Compliance
# The Linux Foundation launched the Open Compliance Program, including tools, training, and consulting.

Funding
# VentureBeat reported that Joyent has raised $7m in a second round of funding.

# Basho Technologies secured $2m from angel investors in a Series C preferred equity financing.

# …

[Read more]
Installing A Web, Email And MySQL Database Cluster (Mirror) On Debian 5.0 With ISPConfig 3

Installing A Web, Email And MySQL Database Cluster (Mirror) On Debian 5.0 With ISPConfig 3

This tutorial describes the installation of a clustered Web, Email, Database and DNS server to be used for redundancy, high availability and load balancing on Debian 5 with the ISPConfig 3 control panel. GlusterFS will be used to mirror the data between the servers and ISPConfig for mirroring the configuration files. I will use a setup of two servers here for demonstration purposes but the setup can scale to a higher number of servers with only minor modifications in the GlusterFS configuration files.

Seeking talks for the MySQL stream at the UKOUG Conference in Birmingham (2010-11-29/2010-12-01)

Similar to events in the US and Germany, another large Oracle User Group organization is preparing for their annual conference and would like to set up a dedicated track of sessions about MySQL – this time it's the British UKOUG  which organizes the Conference Series Technology & E-Business Suite 2010.

This annual user group event will offer a place to share knowledge and hear the latest information from key personnel about product development. This event is a technical event and not a marketing event and we'd like to encourage you to submit a MySQL-related talk!

Some more information about this conference:

  • Dates: Monday 29th November – Wednesday 1st …
[Read more]
Be Careful While Using UNSIGNED Data Type in the Routine Body, Part 2

In one of our posts, in the Be Careful While Using UNSIGNED Data Type in the Routine Body one, we’ve explained how to get invalid data in routine body when using UNSIGNED data type and that in this case MySQL does not throw any exceptions.

One of the possible solutions of this problem is explicit setting of the NO_UNSIGNED_SUBTRACTION mode as it is shown in an example in the MySQL documentation.

Let’s modify a routine script:

SET SQL_MODE = 'NO_UNSIGNED_SUBTRACTION';
DROP PROCEDURE IF EXISTS tinyintunsigned_to_tinyint;
DELIMITER $$
CREATE PROCEDURE tinyintunsigned_to_tinyint()
BEGIN
    DECLARE v_TINYINT TINYINT;
-- Range for v_TINYINT :         -128 .. 0 .. 127
    DECLARE v_TINYINTUNSIGNED TINYINT UNSIGNED;
-- Range for …
[Read more]
On HTML Sanitization, What, Why, How

This is a very good article discussing the different HTML Sanitizers available in the PHP community, what they mean, and the general state of things. Even the WordPress sanitizer (Kses) is included in this review. I really recommend you read this before you start building your own mini cms.

libdrizzle in Visual Studio

Thanks to Jobin's work with mingw and getting libdrizzle to compile on Windows at all, I have been able to get it working in Visual Studio natively. The code is in trunk now.

The approach I took, which is how I'm going to approach Windows and Visual Studio for all of our stuff, is to not worry with analogues to things like configure on Windows. Windows is a very different platform from Linux, and there is no need to attempt to duplicate Linux process there. To that end, the goal at least for now will be static VS Solution files and a set of instructions of how to get depends installed so that the Solution can find them. 

I'm excited to start poking at Garrett Serack's CoApp Project, which has some tools do do tracing of things like make to help with the initial project creation... …

[Read more]
How to Improve Query Cache Performance

The MySQL query cache can be very useful in environments where data is not modified often, and traffic consists of mostly reads. It can improve performance by quite a bit if used correctly, but can actually degrade performance if configuration, queries, and traffic patterns are not optimized for it.

Let me quickly go over what the query cache is, and what it is not. The query cache does not cache the query execution plan, the full page on disk (which is what the InnoDB buffer pool is used for), DDL statements, or any queries that modify data (INSERT/UPDATE/etc). The query cache *does* cache the full result set of “cacheable” SELECT queries. For a query to be “cacheable”, it must have the following properties:

  • It must be deterministic. The query must return the same result set each time that it is run. This means that it may not contain any non-deterministic variables, such as …
[Read more]
MySQL Sunday at Oracle Open World


  

Looks like Oracle is continuing to invest heavily in MySQL and the storage engine eco-system.  They've announced a full MySQL Sunday at the upcoming Oracle Open World Sunday September 19, in San Francisco.  Registration is only $75 which is a bargoon.  I expect this will be bigger than any MySQL conference held to date.  And there's also the JavaOne developer conference and the rest of the Oracle Open World show.

Ok, technically things actually start at noon, but knowing the MySQL crowd, I am sure there will be parties that go well past midnight.  Helan gar!

  • Oracle Open World:
[Read more]
Federated tables bug

Scenario
Recently came across this bug when trying out the federated storage engine for the first time in MySQL 5.1. Had a security table with user information on a remote server & database that needed to be joined to a local table housing site-specific permissions but only containing user IDs. I definitely wanted to use the “create server” method for the new table in case we later decided to link to a different table in the same remote database. A terrific little feature of the MySQL federated storage engine, to be sure.

Problem
The local server was the master in a replication pair. After executing the create server statement on the master, I proceeded to create the new federated table pointed to the new remote server. That’s when my mysql replication monitoring script alerted me that the replication thread had …

[Read more]
Showing entries 23171 to 23180 of 44965
« 10 Newer Entries | 10 Older Entries »