<< NetBeans IDE Configuration - TOC >>

Developing CSQL application with Eclipse IDE for Java Developers

Using eclipse, we will develop an example application that will document key structures, and demonstrate several API calls. This chapter will cover Eclipse for CSQL client development.

This section has the following sections:

  • Overview
  • Preliminary Setup
  • Configuring Eclipse with JDBC Driver
  • Creating Application and Accessing Database data

Overview

The configuration of Eclipse for client access to a database is by adding JDBC Driver to the IDE.

To demonstrate, we shall create an example table in the CSQL database and establish a JDBC connection to the CSQL database from the Eclipse IDE. Next, we shall insert, retrieve, update and delete and display the example data in the GUI SQL client.

Preliminary Setup

  1. Download the Eclipse package from the http://www.eclipse.org/downloads/
  2. Extract the (.tar.gz) file to the <Eclipse>/eclipse directory. <Eclipse> is the directory in which eclipse is installed.
  3. In one terminal set up the class path of the Driver by using (. ./setupenv.ksh) script, which is present in CSQL root directory.
  4. Go to your appropriate directory where you have extracted the package.
  5. Run the below script to start the Eclipse IDE
     $cd eclipse
     $./eclipse
  1. Run the CSQL server in one terminal, Refer CSQL User Manual to know how to download CSQL and start it.

Configuring Eclipse

We can start configuring by performing the below steps,

  • Create a New Project
  • Set up Driver
  • Create a New Project

Go to File in main toolbar, Select New from the drop down menu, a pop-up titled Project appears. Now follow the below steps:

Click on Project titled, a new dialog box will appear Select the titled Java Project from the drop down menu Click Next, a new window will create Type a project name in the Project Name box. (In Figure 2a. – it is CsqlTest) Click on Finish, then Yes.

After creating a new project (CsqlTest), a number application can be run.

Setting up the JDBC Driver

The name of the JDBC Driver is CsqlJdbcDriver.jar, which needs to be set in the project properties to interact with CSQL. It is explained in the below steps.

Right Click on CsqlTest (what we created as our new project) in your left hand pan under Package Explorer menu. Go to Properties title and click on that, it will show a dialog box. Click on Java Build Path > Libraries > Add External JARS button (Illustrated in Figure 3.) In a new dialog box, select the CsqlJdbcDriver.jar file, which will be under /csql/install/lib directory.

Creating Application and Accessing Database data

We will create an application named CsqlExample.java under CsqlTest project, which will create a table and perform the insert, update and delete operation to access CSQL database.

Follow the below steps to perform the above action;

Double click on CsqlTest, which is present on your left hand pan. Right click on Src Go to New Class, and give your application name in Name box. Click on Finish

Now write the java code to access the database data in CsqlExample.java application.

Connection String and Flag for to connect to JDBC Driver:

Class.forName(“csql.jdbc.JdbcSqlDriver”);
Connection con = DriverManager.getConnection(“jdbc:csql”, “root”, “manager”);
Page last modified on October 13, 2009, at 04:26 AM