3 # 1. Create 2 tables in each of the TDB in
4 # MySQL, Postgres,DB2 and Oracle.
6 # Default DSN is set as "myodbc3".
7 # Use "cachetable tool" to cache the tables from DSNs.
9 # 1. cache one table from each DSN.
10 # 2. Now use "cachetable -d <dsName>" to cache all tables
12 # Run this test only under cql/test or on this directory,
13 # Otherwise it will fail.
16 input
=${PWD}/cache
/MultiDsn
/CacheToolOptions
/mysqltable.sql
20 REL_PATH
=${PWD}/cache
/MultiDsn
/CacheToolOptions
24 cp -f $REL_PATH/csql.conf
/tmp
25 export CSQL_CONFIG_FILE
=/tmp
/csql.conf
27 echo DSN
=$MYSQL_DSN >>$CSQL_CONFIG_FILE
29 rm -f /tmp
/csql
/csqlds.conf
30 touch /tmp
/csql
/csqlds.conf
32 ########## csqlds.conf entries #########
34 $CSQL_INSTALL_ROOT/bin
/csqlds
-U $MYSQL_USER -P $MYSQL_PASSWORD -D $MYSQL_DSN -N $MYSQL_TDB -a
39 echo "Entries made for $MYSQL_DSN in csqlds.conf file."
41 $CSQL_INSTALL_ROOT/bin
/csqlds
-U $POSTGRES_USER -P $POSTGRES_PASSWORD -D $POSTGRES_DSN -N $POSTGRES_TDB -a
46 echo "Entries made for $POSTGRES_DSN in csqlds.conf file."
48 $CSQL_INSTALL_ROOT/bin
/csqlds
-U $DB2_USER -P $DB2_PASSWORD -D $DB2_DSN -N $DB2_TDB -a
53 echo "Entries made for $DB2_DSN in csqlds.conf file."
55 $CSQL_INSTALL_ROOT/bin
/csqlds
-U $ORACLE_USER -P $ORACLE_PASSWORD -D $ORACLE_DSN -N $ORACLE_TDB -a
60 echo "Entries made for $ORACLE_DSN in csqlds.conf file."
62 #drop teh table in all DSN if exists.
63 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
64 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
65 isql
$DS3 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
66 isql
$DS4 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
68 ####### Craete Table in all DSN #######
70 isql
$DS1 < ${REL_PATH}/mysqltable.sql
>/dev
/null
2>&1
75 echo "Table 't1 and t2' is created in $MYSQL_DSN"
77 isql
$DS2 < ${REL_PATH}/psqltable.sql
>/dev
/null
2>&1
80 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
83 echo "Table 't3 and t4' is created in $POSTGRES_DSN"
85 isql
$DS3 < ${REL_PATH}/db2table.sql
>/dev
/null
2>&1
88 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
89 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
92 echo "Table 't5 and t6' is created in $DB2_DSN"
94 isql
$DS4 < ${REL_PATH}/oracletable.sql
>/dev
/null
2>&1
97 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
98 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
99 isql
$DS3 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
102 echo "Table 't7 and t8' is created in $ORACLE_DSN"
105 rm -f /tmp
/csql
/csqltable.conf
106 touch /tmp
/csql
/csqltable.conf
108 # Start teh csql server.
109 $CSQL_INSTALL_ROOT/bin
/csqlserver
>/dev
/null
2>&1 &
113 #### cache single table from DSNs #####
116 echo "Cache t1 table from MySQL."
117 $CSQL_INSTALL_ROOT/bin
/cachetable
-t t1
-d $MYSQL_DSN
121 ipcrm
-M 1199 -M 2277
122 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
123 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
124 isql
$DS3 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
125 isql
$DS4 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
129 echo "Cache t3 table from Postgres."
130 $CSQL_INSTALL_ROOT/bin
/cachetable
-t t3
-d $POSTGRES_DSN
134 ipcrm
-M 1199 -M 2277
135 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
136 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
137 isql
$DS3 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
138 isql
$DS4 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
142 echo "Cache t5 table from DB2."
143 $CSQL_INSTALL_ROOT/bin
/cachetable
-t t5
-d $DB2_DSN
147 ipcrm
-M 1199 -M 2277
148 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
149 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
150 isql
$DS3 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
151 isql
$DS4 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
155 echo "Cache t7 table from Oracle."
156 $CSQL_INSTALL_ROOT/bin
/cachetable
-t t7
-d $ORACLE_DSN
160 ipcrm
-M 1199 -M 2277
161 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
162 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
163 isql
$DS3 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
164 isql
$DS4 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
168 #### cache all the table from DSNs #####
170 echo "Table from MySQL"
171 $CSQL_INSTALL_ROOT/bin
/cachetable
-d $MYSQL_DSN
175 ipcrm
-M 1199 -M 2277
176 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
177 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
178 isql
$DS3 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
179 isql
$DS4 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
184 echo "Tables from Postgres"
185 $CSQL_INSTALL_ROOT/bin
/cachetable
-d $POSTGRES_DSN
189 ipcrm
-M 1199 -M 2277
190 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
191 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
192 isql
$DS3 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
193 isql
$DS4 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
198 echo "Tables from DB2"
199 $CSQL_INSTALL_ROOT/bin
/cachetable
-d $DB2_DSN
203 ipcrm
-M 1199 -M 2277
204 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
205 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
206 isql
$DS3 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
207 isql
$DS4 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
212 echo "Tables from Oracle"
213 $CSQL_INSTALL_ROOT/bin
/cachetable
-d $ORACLE_DSN
217 ipcrm
-M 1199 -M 2277
218 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
219 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
220 isql
$DS3 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
221 isql
$DS4 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
225 rm -f /tmp
/csql
/csqltable.conf
226 touch /tmp
/csql
/csqltable.conf
228 rm -f /tmp
/csql
/csqlds.conf
229 touch /tmp
/csql
/csqlds.conf
231 isql
$DS1 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
232 isql
$DS2 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
233 isql
$DS3 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
234 isql
$DS4 < ${REL_PATH}/drop.sql
>/dev
/null
2>&1
237 $CSQL_INSTALL_ROOT/bin
/csql
-s $REL_PATH/drop.sql
> /dev
/null
2>&1
239 ipcrm
-M 1199 -M 2277