ActiveBlog

Introducing Komodo IDE's Database Explorer
by Eric Promislow

Eric Promislow, October 25, 2010

Data. It's everywhere. We leave a trail of it everywhere we go, both on the web, and in real life, and these days there aren't many applications that don't use a database, even if it's just a simple table to track high scores in a game. And while the languages Komodo supports are great for interacting with databases, if you wanted to view your database tables you needed to use a tool outside Komodo.

Database Explorer Screencast

We wanted to add a tool to Komodo to make it easy to see what your data is doing, so we built the Database Explorer. This article will give a quick overview on how to use it. For those who prefer a demonstration, there's also a short screencast (click to the right).

Database Connections

To add a new database connection, bring up the Databases tab in the sidebar, and click on the "add database" icon in the upper left. This brings up a simple properties dialog that distinguishes between file-based databases (like SQLite) and connection-based ones (like MySQL). For the latter, Komodo lets you specify whether the connection needs a password or not; this lets you distinguish a non-password account from one where the password is the empty string (true, neither is a good idea for a production database, but both are common with development databases located inside a firewall).


Exploring

Once you've specified some databases, you can browse them in the sidebar.

In the example here, Komodo is showing the list of databases in the MySQL connection, but the list of tables in the SQLite database. Each database has a different kind of hierarchy, and the database explorer adjusts accordingly.

Inspecting and Querying

Double-clicking on a table brings up a separate window. You can browse the full table's contents, view its schema, or create and run custom queries. One of the problems viewing this kind of data with the standard command-line tools is that there are often too many columns to fit on a single row.

This figure shows how you can choose which columns to view and which to exclude. Komodo retains this info across sessions, so you don't have to constantly uncheck uninteresting columns.

The database explorer is a general tool, so it doesn't know the semantics of each field. To help make sense of data, the explorer supports adding filters to each database's adapter. For example, people often use floating point or long integers to denote timestamps in SQLite. This figure shows how you can have the database explorer reinterpret a numeric field as an SQLite date, time, or datetime field.

Database Support

Komodo currently ships with support for SQLite3, and extensions for MySQL and Oracle are available at the community site, with support for PostgreSQL expected soon. All the databases have the same front-end UI in Komodo.

Extension Developers

One cool aspect here is that each database connection is a Komodo/Mozilla extension that implements a few of Komodo's own interfaces, including "koIDBXConnection" and "koIDBXTableConnector". When it's loaded, each extension is responsible for making sure it can load all of its dependencies (usually a database client library). If it's successful, it automatically advertises its availability to Komodo.

If you're interested in adding support for a database, please see the code for the MySQL adapter as a reference.

Subscribe to ActiveState Blogs by Email

Share this post:

Category: komodo
About the Author: RSS

Eric Promislow is a senior developer who's worked on Komodo since the very beginning. He has a M.Sc. in Computing Science from Queen's University and a B.Sc. in Biophysics from the University of Ontario. Before joining ActiveState, he helped create the OmniMark text-processing language.

Comments

6 comments for Introducing Komodo IDE's Database Explorer
Permalink

Nice option instead of always using PHPMyAdmin..

Permalink

I don't mean to be overly harsh here. It seems ActiveState has developed this fairly nicely. However, I would prefer that development resources had not been spent on this. I've used several IDEs that have database access methods. I've rarely used any of them. Generally, the implementations aren't as robust as tools that are designed only for database management, query, etc.

I am making a very generalized statement here : I imagine almost all developers already have some preferred method of accessing their databases. I would be very surprised to see demand for, let alone use, of this feature being very high.

So, rather than bloating the feature set, I think ActiveState would be better off making Komodo the best, most bug free, IDE available.

Permalink

Everyone on the Komodo team is working towards making it "the best, most bug free, IDE available", but there's a balance to be struck between new features and bug fixes / performance improvements. Though the Database Explorer isn't something you wanted, it is a useful feature that people have been asking us for since Komodo 4.

The new Publishing feature is another example. For people using SVN or Git to deploy their website, this may be a feature they will never use. But for people who use this workflow, not having Publishing in Komodo was a show-stopper.

You can always expect to see brand new features in each major release, both to entice new users to Komodo IDE and to give existing users more reasons to upgrade. Work to fix bugs and improve performance and usability doesn't stop between major releases, and we'll continue releasing point- and patch-level updates to make these improvements available.

Permalink

Troy,

Thanks for the response. Your link proves my "very generalized statement" was incorrect. I'm sure those that asked for it do appreciate the new functionality.

I certainly see your point between balancing the status quo against new feature requests. I guess that is something all of us developers have to juggle on a daily basis.

Again, thanks for clarifying.
Justin

Permalink

"with support for PostgreSQL expected soon". Still waiting...