SQLFun


SqlFun Version 1.1


SqlFun is a Java program/applet that allows you to experiment with SQL statements [hopefully] without having to install a SQL server or database program. All you need is Java and Windows ODBC (or any other database server that supports JDBC). SqlFun is compiled with Java 1.2. You will need the Java Runtime Environment (JRE 1.2) in order to run it. Although SqlFun can be run as an applet (using Java Plug-in), you may encounter Access Violation Error when you try to connection to your data source via sun.jdbc.odbc.JdbcOdbcDriver.


Here is how you can create an experimental Windows ODBC TEXT data source to experiment with SqlFun:
  • Create a directory anywhere in your hard drive, say, C:\temp\experimentaldatabase. This directory will contain the data of your experimental database.
  • From Control Panel, starts up ODBC Data Sources.
  • In the User DSN tab, click on the Add button.
  • Then choose Microsoft Text Driver.
  • In the ODBC Text Setup dialog, enter ExperimentalDatabase as the Data Source Name.
  • Uncheck Use Current Directory and click on Select Directory.
  • Pick the directory you created in the first step. If the OK button is not enabled, change the Save file as type to All Files.
  • Now your experimental data source is ready.

When your data source is ready, you can start up SqlFun (as described at the end of this page). Once SqlFun is up and running, the first thing you need to do is to connection to your data source. Choose the menu item File | Connect. When prompted for JDBC driver and database URL, just accept the default values (if you have created your data source as described above).

If you are a Windows user, you may want to choose the Windows Look and Feel, by choosing the menu item L&F | L&F:Windows. (There seems to be some bugs with Swing though.)

If everything is OK, you are ready to write some SQL statements like:
  1. Create a table called test with fields field1 and field2.
      CREATE TABLE test (field1 char (20), field2 char (20))
         
  2. Add values to the table test.
      INSERT INTO test VALUES ('This is field1', 'This is field2')
         
    and
      INSERT INTO test VALUES ('value2 of field1 ', 'value2 of field2')
         
  3. Display the records in the table test.
      SELECT * FROM test
         
  4. Remove the table test.
      DROP TABLE test
         

Download: SqlFun.jar (14KB). After you downloaded the JAR file, you do not need to extract the class files to your hard drive. Here is one way to run this Java (JRE 1.2) program:
java -cp SqlFun.jar SqlFun

Back to the SQLFun page

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.