adding gw example to jdbc
[csql.git] / examples / jdbc / README
bloba195b08a5c3c68136e97a2c3e2d4d2033d3b29c0
1 ----------------------------------README---------------------------------------
2 This contains an example program that demonstates usage of jdbc interface.
4 What it does?
5 -------------
6 It creates table T1 with two fields f1 integer and f2 string.
7 Creates index on f1 field of T1 table.
8 Inserts 10 rows into the table T1, 1 insert per transaction
9 Update all rows where f1 field have even numbers
10 Delete all rows where f1 value is 0,3,6,9
11 Select rows with f1 value 0 to 9 and displays
12 Drop the table
14 How to compile
15 --------------
16 1. Make a copy of this directory in a writable area
17 2. Edit the Makefile and set the JAVAC variable to point to the javac
18    compiler on your system.
19 3. Use the make command to compile
20         $make
22 How to run
23 ----------
24 1. Set the CSQL_CONFIG_FILE environment variable to absolute path of csql.conf file.
25         $export CSQL_CONFIG_FILE=/tmp/csql.conf
26 2. Set the LD_LIBRARY_PATH environment variable to csql library path
27         $export LD_LIBRARY_PATH=$CSQL_INSTALL_ROOT/lib:$LD_LIBRARY_PATH
29 3. Set the CLASSPATH environment variable to csql jdbc jar 
30         $export CLASSPATH=.:$CLASSPATH:$CSQL_INSTALL_ROOT/lib/CSqlJdbcDriver.jar
31 4. Run the class file created by make
32         $java jdbcexample
34 Note: For running gateway example , makesure that you configure csql.conf and csqltable.conf with appropriate values. Add 1:t1 in the csqltable.conf and create table t1 in MySQL using isql tool as follows
35 $isql myodbc3
36 SQL>CREATE TABLE t1 (f1 integer, f2 char (196), primary key(f1));
37 and then run 
38         $java gwexample
39 Refer usermanual for more information on how to configure caching for MySQL.
41 Output of example:
42 ------------------
43 Table t1 created
44 Index created on T1 (f1) 
45 Total Rows inserted 10
46 Total Rows updated 5
47 Total Rows deleted 4
48 Tuple value is 1 101
49 Tuple value is 2 202
50 Tuple value is 4 204
51 Tuple value is 5 105
52 Tuple value is 7 107
53 Tuple value is 8 208
54 Total Rows selected 6
55 Dropped table T1