Tuesday, August 19, 2008

Sakila Sample database plugin now available from NetBeans Daily Build

NetBeans Logo
MySQL Logo

As I promised in an earlier post, I have created a plugin that makes it very easy for you to load the MySQL Sakila sample database from NetBeans.  Sakila is a serious sample database, with tons of data, and a number of views, stored procedures, triggers and functions to allow you to really explore and test all the various features of MySQL.

If you tried in the past to load Sakila from NetBeans, you were probably quickly dissatisfied.  The editor currently can't handle such a large file, and it didn't handle the delimiters correctly, and it also completely barfed when the script tried to insert a raw PNG file.

So, I fixed all those, and now you simply have to install the plugin, then choose Create Database from your MySQL node in the Database Explorer, and you're off and running.

Here are the steps you need to follow. 

First of all, you need to get a recent 6.5 development build, this does not work with NetBeans 6.5 beta.  Go to http://bits.netbeans.org/dev/nightly/latest/ and get the nightly build from there.

Then you go to Tools->Plugins->Available and choose Sakila Sample Database.  To filter the list, type in Sakila in the matchbox.  Check the install checkbox and choose Install

sakila-plugin.jpg

Now open the Services tab, expand Databases, and connect to your MySQL server through the MySQL node.  If you don't have this node, right-click on Databases and choose Register MySQL Server.

Once you are connected, right-click on the node and choose Create Database...

sakila-create-db.jpg

This brings up a little dialog with a drop-down list of sample names.  Note that sakila is on the list - that was added by the plugin. 

sakila-choose-db.jpg

Choose sakila and click OK.

You are then presented with a dialog to create a new connection for the new database. 

sakila-create-connection.jpg

Type in the appropriate user and password, press OK, and then press OK when asked to choose a schema (I really should fix this, you don't choose schemas in MySQL as a schema and a database are the same thing).

At this point the plugin merrily creates all the tables, views, stored procedures and triggers for Sakila and then loads up all the data.  One thing I need to fix is to add a progress bar so you know when it's done, but just keep your eye on the output window(s).  (Another thing to fix: don't have multiple output windows.  But hey, this is still in beta :)).

Now you should have all of Sakila loaded up, easy as pie.

sakila-view-data.jpg

Please let me know if you have any feedback, particularly by logging issues.

4 comments:

Saptarshi Purkayastha said...

Hi David,
Awesome work with the plugin. I really like the database features in netbeans 6.5. This is indeed the best way to test all the features!!

Anonymous said...

GREAT!!

Thanks a lot, I do really appreciate this help. The job perform from people like you, makes better ways for the incoming developers.

Once again, thanks.

Alejandro Bernal C.

Anonymous said...

Great & Very Usefull

Ranjan said...

mymail-ranjanch2009@gmail.com

Pls answere me?
I am very beginner to java.I installed sakila database.

I right-click on the node(MySQL Server at localhost 3306[root]) and choose Create Database.Then from pop-up dialog box with a drop-down list of sample names,I selected Sample database sakila & click ok.It gives following error message"An error was encountered while creating the database:Creation of Sakila sample database had errors.Please see the message log for details."
(1).How to fix this error?

I click "ok" for this error message & it gives "Conform Delete Newly Created Database" dialog box asking that"An error occur after creating the database.would you like to delete the database?"

I cilcked "NO".I checked the Database.Database & tables are there.But the your inserted data is not there.

(2).what is the reason for this?
Thank you very much

mymail-ranjanch2009@gmail.com