2 import java
.util
.Hashtable
;
3 import java
.sql
.SQLException
;
5 interface JSqlErrorType
7 public static String CSQL_NOT_SUPPORTED
= "00001";
8 public static String CSQL_CON_REJECTED
= "00002";
9 public static String CSQL_TBL_NOT_FOUND
= "00003";
10 public static String CSQL_AUTHEN_ERR
="00004";
11 public static String CSQL_TRANS_NOT_STARTED
="00005";
12 public static String CSQL_TRANS_NOT_ROLLBACK
="00006";
13 public static String CSQL_TRANS_NOT_COMMIT
="00007";
14 public static String CSQL_NOT_DISCONNECT
="00008";
15 public static String CSQL_INVALID_STATE
="00009";
16 public static String CSQL_INVALID_ISOLATION
="00010";
17 public static String CSQL_PREPARE_ERR
="00011";
18 public static String CSQL_EXECUTE_ERR
="00012";
19 public static String CSQL_NOT_PREPARED
="00013";
20 public static String CSQL_NOT_QUERY
="00014";
21 public static String CSQL_NOT_UPDATE
="00015";
22 public static String CSQL_INVALID_DATATYPE
="00016";
23 public static String CSQL_COL_NOT_FOUND
= "00017";
24 public static String CSQL_INVALID_COLNUM
= "00018";
26 public class JSqlError
implements JSqlErrorType
28 public static boolean isDebug
= false;
29 public static Hashtable hashTable
;
32 hashTable
= new Hashtable();
33 hashTable
.put(CSQL_NOT_SUPPORTED
, new SQLException("Feature not supported"));
34 hashTable
.put(CSQL_AUTHEN_ERR
, new SQLException("Authentication error"));
35 hashTable
.put(CSQL_CON_REJECTED
, new SQLException("Connection Rejected"));
36 hashTable
.put(CSQL_TBL_NOT_FOUND
, new SQLException("Table not found"));
37 hashTable
.put(CSQL_TRANS_NOT_STARTED
, new SQLException("Unable to start transaction"));
38 hashTable
.put(CSQL_TRANS_NOT_ROLLBACK
, new SQLException("Unable to rollback transaction"));
39 hashTable
.put(CSQL_TRANS_NOT_COMMIT
, new SQLException("Unable to commit transaction"));
40 hashTable
.put(CSQL_NOT_DISCONNECT
, new SQLException("Unable to disconnect"));
41 hashTable
.put(CSQL_INVALID_STATE
, new SQLException("Invalid state"));
42 hashTable
.put(CSQL_INVALID_ISOLATION
, new SQLException("Invalid isolation level"));
43 hashTable
.put(CSQL_PREPARE_ERR
, new SQLException("Statement Prepare failed"));
44 hashTable
.put(CSQL_EXECUTE_ERR
, new SQLException("Statement execute failed"));
45 hashTable
.put(CSQL_NOT_PREPARED
, new SQLException("Statement not prepared"));
46 hashTable
.put(CSQL_NOT_QUERY
, new SQLException("Statement is not query"));
47 hashTable
.put(CSQL_NOT_UPDATE
, new SQLException("Statement is a query"));
48 hashTable
.put(CSQL_INVALID_DATATYPE
, new SQLException("Invalid data type"));
49 hashTable
.put(CSQL_INVALID_COLNUM
, new SQLException("Invalid column index"));
51 public static String
getErrorMsg(String err
)
53 return("CSqlJDBCDriver: "+ err
+ " "+ hashTable
.get(err
));
56 public static SQLException
getException(String err
)
58 return((SQLException
)hashTable
.get(err
));