Database Configuration

This document describes how to configure various databases for use with the Ruby Support in NetBeans.


The Apache Derby database is referred to as "Java DB" in NetBeans.

The Java DB Tutorial has a lot of information on how to set up the Java DB in NetBeans. This all applies to the Ruby support in NetBeans as well. Obviously, one additional step you'll need to perform is to edit your config/database.yml file to also reference your Java DB connection parameters. In the future, we may automatically configure the database.yml file for you when you create the Rails project and reference an existing data source.

If you are using Java SE 6, Java DB is already bundled with the JDK.


Figure out how to create multiple databases (_development, _test) with Java DB such that Rails can do both development and unit testing with separate databases.


First you'll need to install MySQL on your system. There should be lots of articles on how to do this for the various operating systems.

The following instructions worked for me on Apple OSX, Linux, and Solaris.

On OSX, I had to manually start the database; the MySQL installation came with a "Preference Panel" program which installed a panel in the System Preferences where I can start the database.

Second, I logged in to the database as follows:

$ mysql -u root -p

I then created a couple of databases:

mysql> create database foo_development;
mysql> create database foo_test;
mysql> show databases;

Once that was done I could point NetBeans to the relevant database URL - localhost:3306/foo_development - port 3306 seems to be the default MySQL port. Having done that, I used the builtin NetBeans support to create tables, columns and such. (See the JavaDB tutorial above for details).

For Rails development, you do not need to create tables - Rails does this for you, and the Right Way to do it is to use database migrations. In fact, you don't even need to point NetBeans to your database sources, you only need to configure config/database.yml properly since only Rails will connect to the database.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo