01: /*
02:
03: Derby - Class org.apache.derbyTesting.functionTests.tests.jdbcapi.savepointJdbc30_XA.java
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to You under the Apache License, Version 2.0
09: (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;
25: import java.sql.Savepoint;
26: import java.sql.ResultSet;
27: import java.sql.Statement;
28: import java.sql.SQLException;
29: import java.sql.Types;
30: import java.util.Properties;
31:
32: import javax.sql.XADataSource;
33:
34: import org.apache.derby.tools.ij;
35: import org.apache.derbyTesting.functionTests.util.TestUtil;
36:
37: /**
38: * Additional savepoint tests not available with J2ME for connections
39: * obtained from XADataSource (DERBY-898/DERBY-899)
40: */
41:
42: public class savepointJdbc30_XA extends savepointJdbc30_JSR169 {
43:
44: public static void main(String[] args) {
45: Connection con = null, con2 = null;
46: // Check savepoints for local transactions for
47: // connections fromXADataSource
48:
49: try {
50: // Get a connection just to set up the environment with the properties
51: ij.getPropertyArg(args);
52: ij.startJBMS().close();
53: // Test connections obtained via XADataSource DERBY-898/899
54: Properties dsprops = new Properties();
55: dsprops.setProperty("databaseName", "wombat");
56: XADataSource ds = TestUtil.getXADataSource(dsprops);
57: con = ds.getXAConnection().getConnection();
58: con2 = ds.getXAConnection().getConnection();
59:
60: runTests(
61: "connections from XADataSource (local tranasaction)",
62: con, con2);
63: con.close();
64: con2.close();
65: } catch (SQLException e) {
66: dumpSQLExceptions(e);
67: } catch (Throwable e) {
68: System.out.println("FAIL -- unexpected exception:");
69: e.printStackTrace(System.out);
70: }
71:
72: }
73: }
|