01: /*
02:
03: Derby - Class org.apache.derbyTesting.functionTests.tests.store.bootLock1
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.store;
23:
24: import java.sql.Connection;
25: import java.sql.DriverManager;
26: import java.sql.ResultSetMetaData;
27: import java.sql.ResultSet;
28: import java.sql.Statement;
29: import java.sql.SQLException;
30: import java.sql.Types;
31: import java.util.Properties;
32:
33: import org.apache.derby.tools.ij;
34: import org.apache.derby.tools.JDBCDisplayUtil;
35: import org.apache.derbyTesting.functionTests.util.TestUtil;
36:
37: /**
38: *Just make a connection to wombat ,
39: * Used by bootLock.java to invoke a different jvm and make a connection to wombat
40: * @author suresht
41: */
42:
43: public class bootLock1 {
44: public static void main(String[] args) {
45: Connection con;
46: Statement stmt;
47:
48: try {
49:
50: // use the ij utility to read the property file and
51: // make the initial connection.
52: ij.getPropertyArg(args);
53: Properties prop = new Properties();
54: prop.setProperty("databaseName", "wombat");
55: con = TestUtil.getDataSourceConnection(prop);
56:
57: stmt = con.createStatement();
58: // while we're here, let's cleanup
59: stmt.execute("drop table t1");
60: //infinite loop until it gets killed.
61: for (;;) {
62: Thread.sleep(30000);
63: }
64: } catch (SQLException e) {
65: // System.out.println("FAIL -- unexpected exception");
66: //dumpSQLExceptions(e);
67: //e.printStackTrace();
68: } catch (Throwable e) {
69: //System.out.println("FAIL -- unexpected exception: "+e);
70: //e.printStackTrace();
71: }
72:
73: }
74:
75: static private void dumpSQLExceptions(SQLException se) {
76: while (se != null) {
77: System.out.println("SQLSTATE(" + se.getSQLState() + "): ");
78: se = se.getNextException();
79: }
80: }
81: }
|