KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derbyTesting.functionTests.tests.jdbcapi.savepointJdbc30_XA.java
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 java.sql.Connection JavaDoc;
25 import java.sql.Savepoint JavaDoc;
26 import java.sql.ResultSet JavaDoc;
27 import java.sql.Statement JavaDoc;
28 import java.sql.SQLException JavaDoc;
29 import java.sql.Types JavaDoc;
30 import java.util.Properties JavaDoc;
31
32 import javax.sql.XADataSource JavaDoc;
33
34 import org.apache.derby.tools.ij;
35 import org.apache.derbyTesting.functionTests.util.TestUtil;
36 /**
37  * Additional savepoint tests not available with J2ME for connections
38  * obtained from XADataSource (DERBY-898/DERBY-899)
39  */

40
41
42 public class savepointJdbc30_XA extends savepointJdbc30_JSR169{
43
44
45
46     public static void main(String JavaDoc[] args) {
47         Connection JavaDoc con = null, con2 = null;
48         // Check savepoints for local transactions for
49
// connections fromXADataSource
50

51         try {
52         // Get a connection just to set up the environment with the properties
53
ij.getPropertyArg(args);
54         ij.startJBMS().close();
55         // Test connections obtained via XADataSource DERBY-898/899
56
Properties JavaDoc dsprops = new Properties JavaDoc();
57         dsprops.setProperty("databaseName","wombat");
58         XADataSource JavaDoc ds = TestUtil.getXADataSource(dsprops);
59         con = ds.getXAConnection().getConnection();
60         con2 = ds.getXAConnection().getConnection();
61         
62         runTests("connections from XADataSource (local tranasaction)",
63                  con, con2);
64         con.close();
65         con2.close();
66         }
67         catch (SQLException JavaDoc e) {
68             dumpSQLExceptions(e);
69                 }
70         catch (Throwable JavaDoc e) {
71             System.out.println("FAIL -- unexpected exception:");
72             e.printStackTrace(System.out);
73         }
74
75     }
76 }
77
Popular Tags