Eclipse IDE Configuration to Connect CSQL Main Memory Database
CSQL JDBC driver supports connection through driver manager, data sources object, connection pooling data source object. For Eclipse IDE, you need to configure properly for CSQL database.
For the configuration of Eclipse IDE Go through following step by step procedure.
Download the Eclipse package from the http://www.eclipse.org/downloads/
Extract the (.tar.gz) file to the <Eclipse>/eclipse directory. <Eclipse> is the directory in which eclipse is installed.
Download CSQL Database from http://www.csqldb.com/download.html and extract (.tar.gz) file and Enter into the csql home directory. Run (. ./setupenv.ksh) for necessary path setup.
- Open another terminal. Go to CSQL home directory and Run (. ./setupenv.ksh) for necessary path setup.
- Go to Eclipse home directory and run the below script to start the Eclipse IDE
$ tar –xvf csql2.6-linux-x86.tar.gz
$ cd csql2.6-linux-x86
$ . ./setupenv.ksh
Now you will encounter the below screen.
Figure 1. Splash Screen
Configuring Eclipse For Simple Java Application to Connect CSQL MMDB
For Simple java Application, Now follow the below steps
- Go to File in main toolbar, Select New from the drop down menu, a pop-up titled Project appears
- 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.
Figure 2. Create a New Project
After creating a new project (CsqlTest), a number application can be run .
- Right Click on CsqlTest 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 /csql2.6-linux-x86/lib directory.
- Click on OK
Figure 3. Setting up Driver
- Now 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.(In Figure 4. – it is CsqlExample)
- Click on Finish
Figure 4. Creating a Application
Now write the following java code to access data from database in CsqlExample.java application.
Figure 5. Accessing Database data
To run application Right Click on CsqlTest project, Click on Run As > Java Application.