1 7 8 package java.sql; 9 10 30 public class SQLException extends java.lang.Exception { 31 32 39 public SQLException(String reason, String SQLState, int vendorCode) { 40 super(reason); 41 this.SQLState = SQLState; 42 this.vendorCode = vendorCode; 43 if (!(this instanceof SQLWarning )) { 44 if (DriverManager.getLogWriter() != null) { 45 DriverManager.println("SQLException: SQLState(" + SQLState + 46 ") vendor code(" + vendorCode + ")"); 47 printStackTrace(DriverManager.getLogWriter()); 48 } 49 } 50 } 51 52 53 60 public SQLException(String reason, String SQLState) { 61 super(reason); 62 this.SQLState = SQLState; 63 this.vendorCode = 0; 64 if (!(this instanceof SQLWarning )) { 65 if (DriverManager.getLogWriter() != null) { 66 printStackTrace(DriverManager.getLogWriter()); 67 DriverManager.println("SQLException: SQLState(" + SQLState + ")"); 68 } 69 } 70 } 71 72 79 public SQLException(String reason) { 80 super(reason); 81 this.SQLState = null; 82 this.vendorCode = 0; 83 if (!(this instanceof SQLWarning )) { 84 if (DriverManager.getLogWriter() != null) { 85 printStackTrace(DriverManager.getLogWriter()); 86 } 87 } 88 } 89 90 97 public SQLException() { 98 super(); 99 this.SQLState = null; 100 this.vendorCode = 0; 101 if (!(this instanceof SQLWarning )) { 102 if (DriverManager.getLogWriter() != null) { 103 printStackTrace(DriverManager.getLogWriter()); 104 } 105 } 106 } 107 108 113 public String getSQLState() { 114 return (SQLState); 115 } 116 117 123 public int getErrorCode() { 124 return (vendorCode); 125 } 126 127 135 public SQLException getNextException() { 136 return (next); 137 } 138 139 146 public synchronized void setNextException(SQLException ex) { 147 SQLException theEnd = this; 148 while (theEnd.next != null) { 149 theEnd = theEnd.next; 150 } 151 theEnd.next = ex; 152 } 153 154 157 private String SQLState; 158 159 162 private int vendorCode; 163 164 167 private SQLException next; 168 } 169 | Popular Tags |