KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > functionTests > tests > jdbcapi > StmtCloseFunTest


1 /*
2
3    Derby - Class org.apache.derbyTesting.functionTests.tests.jdbcapi.StmtCloseFunTest
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to You under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derbyTesting.functionTests.tests.jdbcapi;
23
24 import org.apache.derby.tools.ij;
25 import java.sql.Connection JavaDoc;
26 import java.sql.Statement JavaDoc;
27 import java.sql.PreparedStatement JavaDoc;
28 import java.sql.CallableStatement JavaDoc;
29 import java.sql.ResultSet JavaDoc;
30 import java.sql.SQLException JavaDoc;
31 import java.sql.Date JavaDoc;
32 import java.sql.Types JavaDoc;
33 import java.util.GregorianCalendar JavaDoc;
34 import org.apache.derby.iapi.reference.JDBC20Translation;
35 import org.apache.derbyTesting.functionTests.util.BigDecimalHandler;
36 import org.apache.derbyTesting.functionTests.util.TestUtil;
37
38 public class StmtCloseFunTest {
39     
40     private static boolean HAVE_BIG_DECIMAL;
41     private static String JavaDoc CLASS_NAME;
42     
43     //Get the class name to be used for the procedures
44
//outparams - J2ME; outparams30 - non-J2ME
45
static{
46         if(BigDecimalHandler.representation != BigDecimalHandler.BIGDECIMAL_REPRESENTATION)
47             HAVE_BIG_DECIMAL = false;
48         else
49             HAVE_BIG_DECIMAL = true;
50         if(HAVE_BIG_DECIMAL)
51             CLASS_NAME = "org.apache.derbyTesting.functionTests.tests.lang.outparams30.";
52         else
53             CLASS_NAME = "org.apache.derbyTesting.functionTests.tests.lang.outparams.";
54     }
55     
56     static private boolean isDerbyNet = false;
57
58     public static void main(String JavaDoc[] args) {
59
60         System.out.println("Statement Close Fun Test starting ");
61         isDerbyNet = TestUtil.isJCCFramework();
62
63
64
65         try {
66             // use the ij utility to read the property file and
67
// make the initial connection.
68
ij.getPropertyArg(args);
69             Connection JavaDoc conn = ij.startJBMS();
70             cleanUp(conn);
71             test1(conn);
72             test2(conn);
73             test3(conn);
74
75             cleanUp(conn);
76             conn.close();
77                 
78         } catch (SQLException JavaDoc e) {
79             dumpSQLExceptions(e);
80         } catch (Throwable JavaDoc e) {
81             System.out.println("FAIL -- unexpected exception:" + e.toString());
82             e.printStackTrace(System.out);
83         }
84
85         System.out.println("Statement Close Fun Test finished");
86     }
87
88     
89     private static void cleanUp(Connection JavaDoc conn) throws SQLException JavaDoc {
90     Statement JavaDoc s = conn.createStatement();
91     String JavaDoc[] testObjects = {"PROCEDURE TAKESSTRING", "TABLE TAB1", "TABLE TAB2", "TABLE TAB3"};
92         try {
93         TestUtil.cleanUpTest(s, testObjects);
94     } catch (SQLException JavaDoc se){//
95
}
96     }
97
98     private static void test1(Connection JavaDoc conn) {
99         Statement JavaDoc s;
100         try {
101             System.out.println("Statement test begin");
102                 s = conn.createStatement();
103                 /*
104                   We create a table, add a row, and close the statement.
105                 */

106                 s.execute("create table tab1(num int, addr varchar(40))");
107                 s.execute("insert into tab1 values (1910,'Union St.')");
108                 s.close();
109                         
110             try {
111                 s.executeQuery("create table tab2(num int)");
112                 System.out.println("Statement Test failed (1)");
113             }
114             catch(SQLException JavaDoc e) { }
115
116             try {
117                 s.executeUpdate("update tab1 set num=180, addr='Grand Ave.' where num=1910");
118                 System.out.println("Statement Test failed");
119             }
120             catch(SQLException JavaDoc e) { }
121
122             /* close() is the only method that can be called
123              * after a Statement has been closed, as per
124              * Jon Ellis.
125              */

126             try {
127                 s.close();
128             }
129             catch(SQLException JavaDoc e) {
130                 System.out.println("Statement Test failed (2) " + e.toString());
131             }
132
133             try {
134                 s.execute("insert into tab1 values (300,'Lakeside Dr.')");
135                 System.out.println("Statement Test failed (3)");
136             }
137             catch(SQLException JavaDoc e) { }
138
139             try {
140                 s.getMaxFieldSize();
141                 System.out.println("Statement Test failed (4)");
142             }
143             catch(SQLException JavaDoc e) { }
144
145             try {
146                 s.setMaxFieldSize(100);
147                 System.out.println("Statement Test failed (5)");
148             }
149             catch(SQLException JavaDoc e) { }
150
151             try {
152                 s.getMaxRows();
153                 System.out.println("Statement Test failed (6)");
154             }
155             catch(SQLException JavaDoc e) { }
156
157             try {
158                 s.setMaxRows(1000);
159                 System.out.println("Statement Test failed (7)");
160             }
161             catch(SQLException JavaDoc e) { }
162
163             try {
164                 s.setEscapeProcessing(true);
165                 System.out.println("Statement Test failed (8)");
166             }
167             catch(SQLException JavaDoc e) { }
168
169             if (! isDerbyNet)
170             {
171                 // DerbyNet doesn't throw exception
172
try {
173                     s.getQueryTimeout();
174                     System.out.println("Statement Test failed (9)");
175                 }
176                 catch(SQLException JavaDoc e) { }
177             }
178             try {
179                 s.setQueryTimeout(20);
180                 System.out.println("Statement Test failed (10)");
181             }
182             catch(SQLException JavaDoc e) { }
183
184             try {
185                 s.cancel();
186                 System.out.println("Statement Test failed (11)");
187             }
188             catch(SQLException JavaDoc e) { }
189
190             if (isDerbyNet)
191                 System.out.println("beetle 5524");
192             try {
193                 s.getWarnings();
194                 System.out.println("Statement Test failed (12)");
195             }
196             catch(SQLException JavaDoc e) { }
197         
198             if (isDerbyNet)
199                 System.out.println("beetle 5524");
200             try {
201                 s.clearWarnings();
202                 System.out.println("Statement Test failed (13)");
203             }
204             catch(SQLException JavaDoc e) { }
205
206             try {
207                 s.setCursorName("ABC");
208                 System.out.println("Statement Test failed (14)");
209             }
210             catch(SQLException JavaDoc e) { }
211
212             try {
213                 s.execute("create table tab3(num int)");
214                 System.out.println("Statement Test failed (15)");
215             }
216             catch(SQLException JavaDoc e) { }
217
218             try {
219                 s.getResultSet();
220                 System.out.println("Statement Test failed (16)");
221             }
222             catch(SQLException JavaDoc e) { }
223
224             try {
225                 s.getUpdateCount();
226                 System.out.println("Statement Test failed (17)");
227             }
228             catch(SQLException JavaDoc e) { }
229
230             try {
231                 s.getMoreResults();
232                 System.out.println("Statement Test failed (18) ");
233             }
234             catch(SQLException JavaDoc e) { }
235
236             try {
237                 s.getResultSetType();
238                 System.out.println("Statement Test failed (19)");
239             }
240             catch(SQLException JavaDoc e) { }
241
242             try {
243                 s.setFetchDirection(JDBC20Translation.FETCH_FORWARD);
244                 System.out.println("Statement Test failed (20)");
245             }
246             catch(SQLException JavaDoc e) { }
247
248             try {
249                 s.setFetchSize(100);
250                 System.out.println("Statement Test failed (21)");
251             }
252             catch(SQLException JavaDoc e) { }
253
254             try {
255                 s.getFetchSize();
256                 System.out.println("Statement Test failed (22)");
257             }
258             catch(SQLException JavaDoc e) { }
259
260             try {
261                 s.getResultSetConcurrency();
262                 System.out.println("Statement Test failed (23)");
263             }
264             catch(SQLException JavaDoc e) { }
265
266             try {
267                 s.addBatch("create table tab3(age int)");
268                 System.out.println("Statement Test failed (24)");
269             }
270             catch(SQLException JavaDoc e) { }
271
272             try {
273                 s.clearBatch();
274                 System.out.println("Statement Test failed");
275             }
276             catch(SQLException JavaDoc e) { }
277
278             try {
279                 s.executeBatch();
280                 System.out.println("Statement Test failed");
281             }
282             catch(SQLException JavaDoc e) { }
283
284             try {
285                 s.getConnection();
286                 System.out.println("Statement Test failed");
287             }
288             catch(SQLException JavaDoc e) { }
289         }
290         catch (Throwable JavaDoc e) {
291             System.out.println("FAIL -- unexpected exception:" + e.toString());
292             e.printStackTrace(System.out);
293             return;
294         }
295         System.out.println("Statement test end");
296 }
297
298      private static void test2(Connection JavaDoc conn) {
299         PreparedStatement JavaDoc ps;
300         try {
301             System.out.println("Prepared Statement test begin");
302             ps = conn.prepareStatement("create table tab2(a int, b float, c date, d varchar(100))");
303             ps.execute();
304             ps.close();
305
306             //we test execute() and executeQuery() here
307
ps = conn.prepareStatement("select a from tab2");
308             ps.execute();
309             ps.close();
310             try {
311                 ps.execute();
312                 System.out.println("Prepared Statement Test failed");
313             }
314             catch(SQLException JavaDoc e) { }
315
316             try {
317                 ps.executeQuery();
318                 System.out.println("Prepared Statement Test failed");
319             }
320             catch(SQLException JavaDoc e) { }
321         
322             ps = conn.prepareStatement("insert into tab2 values(?, ?, ?, ?)");
323             /*
324               We create a table, add a row, and close the statement.
325             */

326             ps.setInt(1, 420);
327             ps.setFloat(2, (float)12.21);
328             ps.setDate(3, new Date JavaDoc(870505200000L));
329             ps.setString(4, "China");
330             ps.executeUpdate();
331             ps.close();
332                         
333             //now, we begin the test
334
try {
335                 ps.setInt(1, 530);
336                 System.out.println("Prepared Statement Test failed");
337             }
338             catch(SQLException JavaDoc e) { }
339
340             try {
341                 ps.setFloat(2, (float)3.14);
342                 System.out.println("Prepared Statement Test failed");
343             }
344             catch(SQLException JavaDoc e) { }
345
346             try {
347                 ps.setDate(3, new Date JavaDoc(870505200000L));
348                 System.out.println("Prepared Statement Test failed");
349             }
350             catch(SQLException JavaDoc e) { }
351
352             try {
353                 ps.setDate(3, new Date JavaDoc(870505200000L), new GregorianCalendar JavaDoc());
354                 System.out.println("Prepared Statement Test failed");
355             }
356             catch(SQLException JavaDoc e) { }
357
358             try {
359                 ps.setString(4, "HongKong");
360                 System.out.println("Prepared Statement Test failed");
361             }
362             catch(SQLException JavaDoc e) { }
363
364             try {
365                 ps.executeUpdate();
366                 System.out.println("Prepared Statement Test failed");
367             }
368             catch(SQLException JavaDoc e) { }
369
370             /* close() is the only method that can be called
371              * after a Statement has been closed, as per
372              * Jon Ellis.
373              */

374             try {
375                 ps.close();
376             }
377             catch(SQLException JavaDoc e) {
378                 System.out.println("Prepared Statement Test failed");
379             }
380
381             try {
382                 ps.clearParameters();
383                 System.out.println("Prepared Statement Test failed");
384             }
385             catch(SQLException JavaDoc e) { }
386
387             try {
388                 ps.getMetaData();
389                 System.out.println("Prepared Statement Test failed");
390             }
391             catch(SQLException JavaDoc e) { }
392
393             try {
394                 ps.getMaxFieldSize();
395                 System.out.println("Prepared Statement Test failed");
396             }
397             catch(SQLException JavaDoc e) { }
398
399             try {
400                 ps.setMaxFieldSize(100);
401                 System.out.println("Prepared Statement Test failed");
402             }
403             catch(SQLException JavaDoc e) { }
404
405             try {
406                 ps.getMaxRows();
407                 System.out.println("Prepared Statement Test failed");
408             }
409             catch(SQLException JavaDoc e) { }
410
411             try {
412                 ps.setMaxRows(1000);
413                 System.out.println("Prepared Statement Test failed");
414             }
415             catch(SQLException JavaDoc e) { }
416
417             try {
418                 ps.setEscapeProcessing(true);
419                 System.out.println("Prepared Statement Test failed");
420             }
421             catch(SQLException JavaDoc e) { }
422
423             if (! isDerbyNet)
424             {
425                 // DerbyNet doesn't throw exception
426
try {
427                     ps.getQueryTimeout();
428                     System.out.println("Prepared Statement Test failed");
429                 }
430                 catch(SQLException JavaDoc e) { }
431             }
432
433             try {
434                 ps.setQueryTimeout(20);
435                 System.out.println("Prepared Statement Test failed");
436             }
437             catch(SQLException JavaDoc e) { }
438
439             try {
440                 ps.cancel();
441                 System.out.println("Prepared Statement Test failed");
442             }
443             catch(SQLException JavaDoc e) { }
444             
445             if (isDerbyNet)
446                 System.out.println("beetle 5524");
447             try {
448                 ps.getWarnings();
449                 System.out.println("Prepared Statement Test failed");
450             }
451             catch(SQLException JavaDoc e) { }
452
453             if (isDerbyNet)
454                 System.out.println("beetle 5524");
455             try {
456                 ps.clearWarnings();
457                 System.out.println("Prepared Statement Test failed");
458             }
459             catch(SQLException JavaDoc e) { }
460
461             try {
462                 ps.setCursorName("ABC");
463                 System.out.println("Prepared Statement Test failed");
464             }
465             catch(SQLException JavaDoc e) { }
466
467             try {
468                 ps.execute("create table tab3(num int)");
469                 System.out.println("Prepared Statement Test failed");
470             }
471             catch(SQLException JavaDoc e) { }
472
473             try {
474                 ps.getResultSet();
475                 System.out.println("Prepared Statement Test failed");
476             }
477             catch(SQLException JavaDoc e) { }
478
479             try {
480                 ps.getUpdateCount();
481                 System.out.println("Prepared Statement Test failed");
482             }
483             catch(SQLException JavaDoc e) { }
484
485             try {
486                 ps.getMoreResults();
487                 System.out.println("Prepared Statement Test failed");
488             }
489             catch(SQLException JavaDoc e) { }
490
491             try {
492                 ps.getResultSetType();
493                 System.out.println("Prepared Statement Test failed");
494             }
495             catch(SQLException JavaDoc e) { }
496
497             try {
498                 ps.setFetchDirection(JDBC20Translation.FETCH_FORWARD);
499                 System.out.println("Prepared Statement Test failed");
500             }
501             catch(SQLException JavaDoc e) { }
502
503             try {
504                 ps.setFetchSize(100);
505                 System.out.println("Prepared Statement Test failed");
506             }
507             catch(SQLException JavaDoc e) { }
508
509             try {
510                 ps.getFetchSize();
511                 System.out.println("Prepared Statement Test failed");
512             }
513             catch(SQLException JavaDoc e) { }
514
515             try {
516                 ps.getResultSetConcurrency();
517                 System.out.println("Prepared Statement Test failed");
518             }
519             catch(SQLException JavaDoc e) { }
520
521             try {
522                 ps.addBatch();
523                 System.out.println("Prepared Statement Test failed");
524             }
525             catch(SQLException JavaDoc e) { }
526
527             try {
528                 ps.clearBatch();
529                 System.out.println("Prepared Statement Test failed");
530             }
531             catch(SQLException JavaDoc e) { }
532
533             try {
534                 ps.executeBatch();
535                 System.out.println("Prepared Statement Test failed");
536             }
537             catch(SQLException JavaDoc e) { }
538
539             try {
540                 ps.getConnection();
541                 System.out.println("Prepared Statement Test failed");
542             }
543             catch(SQLException JavaDoc e) { }
544         }
545         catch (Throwable JavaDoc e) {
546             System.out.println("FAIL -- unexpected exception:" + e.toString());
547             e.printStackTrace(System.out);
548             return;
549         }
550         System.out.println("Prepared Statement test end");
551 }
552
553      private static void test3(Connection JavaDoc conn) {
554         CallableStatement JavaDoc cs;
555         try {
556             System.out.println("Callable Statement test begin");
557             try {
558
559                 Statement JavaDoc s = conn.createStatement();
560
561                 s.execute("CREATE PROCEDURE takesString(OUT P1 VARCHAR(40), IN P2 INT) " +
562                         "EXTERNAL NAME '" + CLASS_NAME + "takesString'" +
563                         " NO SQL LANGUAGE JAVA PARAMETER STYLE JAVA");
564
565
566                 cs = conn.prepareCall("call takesString(?,?)");
567             
568                 cs.registerOutParameter(1, Types.CHAR);
569                 cs.setInt(2, Types.INTEGER);
570
571                 cs.execute();
572                 System.out.println("The result is " + cs.getString(1));
573
574                 cs.close();
575
576                 try {
577                     cs.setString(1, "ABC");
578                     System.out.println("Callable Statement Test failed");
579                 }
580                 catch(SQLException JavaDoc e) { }
581
582                 try {
583                     cs.registerOutParameter(1, Types.CHAR);
584                     System.out.println("Callable Statement Test failed");
585                 }
586                 catch(SQLException JavaDoc e) { }
587
588                 s.close();
589             }
590         
591             catch(SQLException JavaDoc e) {
592                 dumpSQLExceptions(e);
593             }
594         
595             //now, testing all the inherited functions
596
cs = conn.prepareCall("create table tab3(a int, b float, c varchar(100))");
597             cs.execute();
598             cs.close();
599
600             //we test execute() and executeQuery() here
601
cs = conn.prepareCall("select a from tab3");
602             ResultSet JavaDoc rs = cs.executeQuery();
603             cs.close();
604             try {
605                 cs.execute();
606                 System.out.println("Callable Statement Test failed");
607             }
608             catch(SQLException JavaDoc e) { }
609
610             try {
611                 cs.executeQuery();
612                 System.out.println("Callable Statement Test failed");
613             }
614             catch(SQLException JavaDoc e) { }
615         
616             cs = conn.prepareCall("insert into tab3 values(?, ?, ?)");
617             /*
618               We create a table, add a row, and close the statement.
619             */

620             cs.setInt(1, 420);
621             cs.setFloat(2, (float)12.21);
622             cs.setString(3, "China");
623
624             cs.executeUpdate();
625             cs.close();
626                         
627             //now, we begin the test
628
try {
629                 cs.setInt(1, 530);
630                 System.out.println("Callable Statement Test failed");
631             }
632             catch(SQLException JavaDoc e) { }
633
634             try {
635                 cs.setFloat(2, (float)3.14);
636                 System.out.println("Callable Statement Test failed");
637             }
638             catch(SQLException JavaDoc e) { }
639
640             try {
641                 cs.setString(3, "HongKong");
642                 System.out.println("Callable Statement Test failed");
643             }
644             catch(SQLException JavaDoc e) { }
645
646             try {
647                 cs.executeUpdate();
648                 System.out.println("Callable Statement Test failed");
649             }
650             catch(SQLException JavaDoc e) { }
651
652             /* close() is the only method that can be called
653              * after a Statement has been closed, as per
654              * Jon Ellis.
655              */

656             try {
657                 cs.close();
658             }
659             catch(SQLException JavaDoc e) {
660                 System.out.println("Callable Statement Test failed");
661             }
662
663             try {
664                 cs.clearParameters();
665                 System.out.println("Callable Statement Test failed");
666             }
667             catch(SQLException JavaDoc e) { }
668
669             try {
670                 cs.getMetaData();
671                 System.out.println("Callable Statement Test failed");
672             }
673             catch(SQLException JavaDoc e) { }
674
675             try {
676                 cs.getMaxFieldSize();
677                 System.out.println("Callable Statement Test failed");
678             }
679             catch(SQLException JavaDoc e) { }
680
681             try {
682                 cs.setMaxFieldSize(100);
683                 System.out.println("Callable Statement Test failed");
684             }
685             catch(SQLException JavaDoc e) { }
686
687             try {
688                 cs.getMaxRows();
689                 System.out.println("Callable Statement Test failed");
690             }
691             catch(SQLException JavaDoc e) { }
692
693             try {
694                 cs.setMaxRows(1000);
695                 System.out.println("Callable Statement Test failed");
696             }
697             catch(SQLException JavaDoc e) { }
698
699             try {
700                 cs.setEscapeProcessing(true);
701                 System.out.println("Callable Statement Test failed");
702             }
703             catch(SQLException JavaDoc e) { }
704
705             if (! isDerbyNet)
706             {
707                 // DerbyNet doesn't throw exception
708
try {
709                     cs.getQueryTimeout();
710                     System.out.println("Callable Statement Test failed");
711                 }
712                 catch(SQLException JavaDoc e) { }
713             }
714             
715             try {
716                 cs.setQueryTimeout(20);
717                 System.out.println("Callable Statement Test failed");
718             }
719             catch(SQLException JavaDoc e) { }
720
721             try {
722                 cs.cancel();
723                 System.out.println("Callable Statement Test failed");
724             }
725             catch(SQLException JavaDoc e) { }
726
727             if (isDerbyNet)
728                 System.out.println("beetle 5524");
729             try {
730                 cs.getWarnings();
731                 System.out.println("Callable Statement Test failed");
732             }
733             catch(SQLException JavaDoc e) { }
734
735             if (isDerbyNet)
736                 System.out.println("beetle 5524");
737             try {
738                 cs.clearWarnings();
739                 System.out.println("Callable Statement Test failed");
740             }
741             catch(SQLException JavaDoc e) { }
742
743             try {
744                 cs.setCursorName("ABC");
745                 System.out.println("Callable Statement Test failed");
746             }
747             catch(SQLException JavaDoc e) { }
748
749             try {
750                 cs.execute("create table tab3(num int)");
751                 System.out.println("Callable Statement Test failed");
752             }
753             catch(SQLException JavaDoc e) { }
754
755             try {
756                 cs.getResultSet();
757                 System.out.println("Callable Statement Test failed");
758             }
759             catch(SQLException JavaDoc e) { }
760
761             try {
762                 cs.getUpdateCount();
763                 System.out.println("Callable Statement Test failed");
764             }
765             catch(SQLException JavaDoc e) { }
766
767             try {
768                 cs.getMoreResults();
769                 System.out.println("Callable Statement Test failed");
770             }
771             catch(SQLException JavaDoc e) { }
772
773             try {
774                 cs.getResultSetType();
775                 System.out.println("Callable Statement Test failed");
776             }
777             catch(SQLException JavaDoc e) { }
778
779             try {
780                 cs.setFetchDirection(JDBC20Translation.FETCH_FORWARD);
781                 System.out.println("Callable Statement Test failed");
782             }
783             catch(SQLException JavaDoc e) { }
784
785             try {
786                 cs.setFetchSize(100);
787                 System.out.println("Callable Statement Test failed");
788             }
789             catch(SQLException JavaDoc e) { }
790
791             try {
792                 cs.getFetchSize();
793                 System.out.println("Callable Statement Test failed");
794             }
795             catch(SQLException JavaDoc e) { }
796
797             try {
798                 cs.getResultSetConcurrency();
799                 System.out.println("Callable Statement Test failed");
800             }
801             catch(SQLException JavaDoc e) { }
802
803             try {
804                 cs.addBatch();
805                 System.out.println("Callable Statement Test failed");
806             }
807             catch(SQLException JavaDoc e) { }
808
809             try {
810                 cs.clearBatch();
811                 System.out.println("Callable Statement Test failed");
812             }
813             catch(SQLException JavaDoc e) { }
814
815             try {
816                 cs.executeBatch();
817                 System.out.println("Callable Statement Test failed");
818             }
819             catch(SQLException JavaDoc e) { }
820
821             try {
822                 cs.getConnection();
823                 System.out.println("Callable Statement Test failed");
824             }
825             catch(SQLException JavaDoc e) { }
826         }
827         catch (Throwable JavaDoc e) {
828             System.out.println("FAIL -- unexpected exception:" + e.toString());
829             e.printStackTrace(System.out);
830             return;
831         }
832         System.out.println("Callable Statement test end");
833 }
834
835
836     static private void dumpSQLExceptions (SQLException JavaDoc se) {
837         System.out.println("FAIL -- unexpected exception: " + se.toString());
838         while (se != null) {
839             System.out.print("SQLSTATE("+se.getSQLState()+"):");
840             se = se.getNextException();
841         }
842     }
843
844 }
845
846
847
848
849
850
851
Popular Tags