Monday Aug 24, 2009

Using MySQL with Microsoft .Net

I had a query recently from a partner, who was planning to integrate Microsoft .Net applications with MySQL. I am not an expert on .Net, but I looked around and found the following resources and pointers that will help:

  1. There is an excellent webinar on Microsoft Entity framework and using MySQL at the Mysql website.
  2. MySQL .Net connectors are available for download at the MySQL website
  3. Another persistence framework, nHibernate can also be used for data persistence. I just googled, and found this useful link and this link about the integration.
Hope this helps ..

Thursday Jul 09, 2009

What I learned about MySQL in class !!

I and my team, were fortunate enough to get sponsored to attend a 5 day MySQL for DBA's training in Bangalore recently. Even though, I am not a DBA, nor do I intend to become one, but there is upswell of interest for MySQL in India, every customer and partner seems to want to know more about it and there is ever growing linkage between other Sun Middleware products and MySQL.

Lets take the following products and how MySQL fits in:


There you have it, there is a fitment with MySQL with almost all of our middle ware products !!

The following are some key things (in my personal opinion) which makes MySQL stand out, from other commercial or open source databases:

  1. Everything and any server configuration settings can be changed/viewed using the my.ini (on Windows) or my.cnf (on Solaris and Linux) files. It is extremely simple. Just add it, under the appropriate headers and it will be picked up by MySQL when in starts. Plus, there are some sample, configuration files, which show sample settings for large or medium kind of databases.
  2. The concept of Storage engines, and switching storage engines, having different storage engines in a single database, blows you away !!! Moving databases, renaming databases is a snap, as simple as renaming files (for Innodb) or changing directory names (for ISAM). Knowledge of different Storage engines can be a little intimidating at first, but for now, there are a few parameters like - what kind of applications will be using it? do you need transactions/ACID compliance? etc etc. Google "compare MYSQL storage engines"
  3. Setting up a MySQL replication with a Master/Slave, is a breeze, and can be done in less than 10 mins for a simple setup. You will find good information in the MySQL documentation.
  4. Every configuration variable setting, can be found using "MySQL>show variables like '%keyword%';" command.
  5. Doing a backup and restore of MySQL data is so simple using mysqldump.
  6. Tuning of MySQL databases seemed to be straightforward, will write up more stuff, as I experiment more. But generally, there are plenty of aids, which explain where time is being spent on queries, and how we can improve them
  7. Creating Triggers, Stored procedures are simple, and like other databases.
This is it for, more later ...

Thursday Apr 23, 2009

Connecting to a MySQL Master/Slave replication with JDBC and Glassfish

MySQL has been having a lot of traction with customers, partners and developers in India. A very popular architecture for using MySQL for large scale deployments is the MySQL Master/Slave replication (Replication enables data from one MySQL database server (called the master) to be replicated to one or more MySQL database servers (slaves)).
Credit: Image is linked from http://dev.mysql.com/doc/refman/5.0/en/replication-solutions-scaleout.html.

One of things that change for developers, who are used to developing with other databases like Oracle, MS SQL server is the question on connecting to a MySQL master/Slave setup. There are several good resources which explain how to do this:
1. From MySQL web site: A snippet of the code from that article is reproduced below :
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Properties;

import com.mysql.jdbc.ReplicationDriver;

public class ReplicationDriverDemo {

  public static void main(String[] args) throws Exception {
    ReplicationDriver driver = new ReplicationDriver();

    Properties props = new Properties();

    // We want this for failover on the slaves
    props.put("autoReconnect", "true");

    // We want to load balance between the slaves
    props.put("roundRobinLoadBalance", "true");

    props.put("user", "foo");
    props.put("password", "bar");

    //
    // Looks like a normal MySQL JDBC url, with a
    // comma-separated list of hosts, the first 
    // being the 'master', the rest being any number
    // of slaves that the driver will load balance against
    //

    Connection conn =
        driver.connect("jdbc:mysql://master,slave1,slave2,slave3/test",
            props);

    //
    // Perform read/write work on the master
    // by setting the read-only flag to "false"
    //

    conn.setReadOnly(false);
    conn.setAutoCommit(false);
    conn.createStatement().executeUpdate("UPDATE some_table ....");
    conn.commit();

    //
    // Now, do a query from a slave, the driver automatically picks one
    // from the list
    //

    conn.setReadOnly(true);

    ResultSet rs = 
      conn.createStatement().executeQuery("SELECT a,b FROM alt_table");

     .......
  }
}

Note: Please refer to the mySQL web site for any updates.
2. If you are using Spring, Hibernate and other popular frameworks, an article at http://neilhan.blogspot.com/2006/11/spring-hibernate-and-mysql-replication.html tells you how to do it.

Monday Jan 12, 2009

Try MySQL Enterprise for Free for 30 days

There are several thousand users of the free MySQL community edition, around the world including India. MySQL Enterprise, the paid commercial subscription offering, is available for trial for 30 days. As part of the MySQL Enterprise Trial you will be able to evaluate the MySQL Enterprise Monitor which includes:
  • NEW! MySQL Query Analyzer to improve performance by pinpointing and fixing problem SQL code
  • MySQL Enterprise Monitor to monitor MySQL performance, sessions, connections, and more
  • MySQL Replication Monitor that provides real-time information on master/slave performance and latency issues
  • MySQL Advisors to implement security, performance, replication and administration best practices
  • 120+ Advisor Rules that advise you on optimal settings for 600+ MySQL and OS specific variables

More details can be had at http://www.mysql.com/trials/

Tuesday Dec 30, 2008

Sun Identity Manager 8.0.0.4 now supports MySQL 5.0.60SP1 Enterprise Edition as a production repository!

A long pending demand from our customers and from the field, was to support MySQL as a repository in production (it was only supported in development so far) for Sun Identity Manager. This has come true with the release of the 8.0.4 patch, where MySQL 5.0.60SP1 is now supported in production. if you have a valid sunsolve account, you can download the Identity manager patch at http://sunsolve.sun.com/search/document.do?assetkey=1-21-139010-04-1.
With this, the TCO offered by the Sun Identity Manager + MySQL combination will be very compelling and competitive.

Wednesday Jul 23, 2008

MySQL Camp in Bangalore - July 29th 2008

A free MySQL camp is being scheduled in Bangalore on July 29th 2008. Please see http://blogs.sun.com/amitsaha/entry/mysql_camp_in_bangalore_july for more details. The agenda looks good. Also, of interest, the MySQL user group in Bangalore is being launched.
About

Ramblings of a Sun engineer based in Bangalore, India. Strictly my own views and not my employer's.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today