KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > functionTests > tests > store > bootLock1


1 /*
2
3    Derby - Class org.apache.derbyTesting.functionTests.tests.store.bootLock1
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.store;
23
24 import java.sql.Connection JavaDoc;
25 import java.sql.DriverManager JavaDoc;
26 import java.sql.ResultSetMetaData JavaDoc;
27 import java.sql.ResultSet JavaDoc;
28 import java.sql.Statement JavaDoc;
29 import java.sql.SQLException JavaDoc;
30 import java.sql.Types JavaDoc;
31 import java.util.Properties JavaDoc;
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 JavaDoc[] args) {
45         Connection JavaDoc con;
46         Statement JavaDoc stmt;
47
48         try
49         {
50
51             // use the ij utility to read the property file and
52
// make the initial connection.
53
ij.getPropertyArg(args);
54             Properties JavaDoc prop = new Properties JavaDoc();
55             prop.setProperty("databaseName", "wombat");
56             con = TestUtil.getDataSourceConnection(prop);
57
58             stmt = con.createStatement();
59             // while we're here, let's cleanup
60
stmt.execute("drop table t1");
61             //infinite loop until it gets killed.
62
for(;;)
63             {
64                 Thread.sleep(30000);
65             }
66         }
67         catch (SQLException JavaDoc e) {
68             // System.out.println("FAIL -- unexpected exception");
69
//dumpSQLExceptions(e);
70
//e.printStackTrace();
71
}
72         catch (Throwable JavaDoc e) {
73             //System.out.println("FAIL -- unexpected exception: "+e);
74
//e.printStackTrace();
75
}
76
77     }
78
79     static private void dumpSQLExceptions (SQLException JavaDoc se) {
80         while (se != null) {
81             System.out.println("SQLSTATE("+se.getSQLState()+"): ");
82             se = se.getNextException();
83         }
84     }
85 }
86
87
88
89
90
Popular Tags