adding test scripts
[csql.git] / test / jdbc / Adapter / ConTest01.java
blob52be9869b608b267752652c7c5244b00879f3a98
1 /* 1. Connect to Target DB using connection string "jdbc:adapter".
3 * 2. Used correct UserName and Password.
4 * 3. Connect to the Target DB and Close the Connection
5 * 4. Again Connect and Close.
6 * 5. It should pass.
8 * Author : Jitendra Lenka
9 */
11 import java.sql.*;
12 public class ConTest01
14 public static void main(String[] args)
16 try
18 Class.forName("csql.jdbc.JdbcSqlDriver");
19 Connection con = null;
20 con=DriverManager.getConnection("jdbc:adapter","root","manager");
21 if(con != null)
23 System.out.println("Connect to Target DB");
25 else
27 System.out.println("Failed to Connect");
28 System.exit(1);
30 con.close();
31 System.out.println("Connection Closed");
32 //-----------------------------
33 con=DriverManager.getConnection("jdbc:adapter","root","manager");
34 if(con != null)
36 System.out.println("Again Connect to Target DB");
38 else
40 System.out.println("Failed to Connect to Target DB");
41 System.exit(1);
43 con.close();
44 System.out.println("Connection Closed");
45 System.exit(0);
46 }catch(Exception e){
47 System.out.println("Exception in Test: " +e);
48 e.getStackTrace();
49 System.exit(1);