Sunday, April 24, 2011

Drizzle JDBC 1.1 - SSL support and multi queries

Just pushed up Drizzle JDBC 1.1 with 2 quite big new features:
  • SSL support - add ?useSSL=true in the connection string (and do the usual ssl-in-java magic to make it work. Check the MySQL documentation for more information, it is set up exactly the same way here)
  • Multi queries - add ?allowMultiQueries=true to your connection string to be able to send several queries in one round trip to the server.
Note that these features are only supported when using the driver against a MySQL server - Drizzle does not have these features (yet).

Download it from the central maven repo (should be synced within an hour or so)

Monday, April 11, 2011

Drizzle JDBC 1.0

Finally got around to making a 1.0-release of Drizzle JDBC, after a while of not getting any bug reports (not at all claiming that it is bug free, but it is stable enough for several companies to use it in production).

Far those new to Drizzle JDBC, it is a BSD-licensed JDBC driver for Drizzle and MySQL.

Changelog

  • DatabaseMetaData fix - return column_type instead of data_type, contains more information (by Stephane Giron)
  • Detect if a blob is actually a CLOB by checking charset number (by Christian Peter)
  • Connect with UTF-8 charset default (bug reported by Marc Isambart)
  • Support for connection timeouts (by Marc Isambart) - add ?connectTimeout=X to have an X second connection timeout.
  • Properly support TIME and BOOLEAN datatypes in Drizzle
  • Move query timeout thread to the Connection class instead of having it in the statement class (duh) - now one extra thread per Connection instead of one per Statement. Is safe since only one statement can run in one connection at a time.
  • Generally shape up UTF8 handling throughout the driver (by Marc Isambart and me).
  • Update copyright headers, now includes the standard Simplified BSD license header.
  • Add an AUTHORS file

Whats next?

So, the general plan for the future is:
  • Make the driver more modular - it should be possible for users to change the behavior of almost every aspect of the driver
  • Support the optional javax.sql packages - XA handling etc. This will be built as a separate maven-published jar to keep size of the basic driver small
  • Support the SQL escape syntax (never used it, but i guess it should be there...)
  • ...

If any of the things above are more important for anyone, please let me know so that i know where to begin.

Thursday, April 7, 2011

Visualizing data in real time using drizzle and rabbitmq, DEMO!

A couple of weeks ago, when Mozilla released firefox 4, i watched glow.mozilla.org - a site made to visualize the firefox downloads in real time. I figured this could be quite a neat use case for my old drizzle to web socket replicator.

So, the compontents involved:

The basic flow is this:
  1. 10 inserts per second are executed in the drizzle database using drizzle-jdbc, these inserts contain a random IP address
  2. Drizzle does its magic and packages up each insert as a google protobuf transaction message
  3. The rabbitmq plugin picks up the message and publishes it to a RabbitMQ server
  4. RabbitReplication consumes the message from RabbitMQ and maps it onto an annotated java object. This gives alot of flexibility to the rabbitreplication user since you can manipulate the information any way you want, in this example i extract a longitude and latitude value from the IP address using MaxMind GeoLite City. Have a look at row the "setSomething()" method in the ExampleRepl.java file. This file is something a rabbitreplication end user would implement and provide
  5. The java object is serialized to json
  6. The json string is published to all connected clients
  7. A javascript on the page takes the lat/lng-values and maps these onto a google map
  8. The same javascript appends some of the raw data to a table

So, I'm hoping the little demo i'm linking below shows some of the extreme flexibility of the Drizzle replication. This, for me, is the unique selling point for Drizzle. Also, if anyone has an actual production use case for this, i'd be extremely happy to help implement it!

http://demo.rabbitreplication.org


(Thanks to Rackspace for hosting!)