01: /*
02:
03: Derby - Class org.apache.derbyTesting.functionTests.tests.lang.logStream
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.lang;
23:
24: import java.sql.*;
25: import java.io.*;
26:
27: import org.apache.derby.tools.ij;
28: import org.apache.derby.tools.JDBCDisplayUtil;
29: import org.apache.derbyTesting.functionTests.util.TestUtil;
30:
31: /**
32: * Demonstrate subselect behavior with prepared statement.
33: */
34: public class logStream {
35:
36: public static void main(String args[]) {
37: try {
38: System.out.println("Start logStream");
39: /* Load the JDBC Driver class */
40: // use the ij utility to read the property file and
41: // make the initial connection.
42: ij.getPropertyArg(args);
43: Connection conn = ij.startJBMS();
44:
45: conn.close();
46:
47: String systemHome = System.getProperty("derby.system.home");
48:
49: File derbyLog = new File(systemHome, "derby.log");
50:
51: System.out.println("derby.log exists ? "
52: + derbyLog.exists());
53: System.out.println("derby.log is directory ? "
54: + derbyLog.isDirectory());
55: System.out.println("derby.log has content ? "
56: + (derbyLog.length() > 0));
57:
58: System.out.println("SHUTDOWN Derby");
59: try {
60: TestUtil.getConnection("", "shutdown=true");
61: System.out
62: .println("FAIL - shutdown returned connection");
63: } catch (SQLException sqle) {
64: System.out.println("SHUTDOWN :" + sqle.getMessage());
65: }
66:
67: System.out.println("derby.log exists ? "
68: + derbyLog.exists());
69: System.out.println("derby.log is directory ? "
70: + derbyLog.isDirectory());
71: System.out.println("derby.log has content ? "
72: + (derbyLog.length() > 0));
73:
74: boolean deleted = derbyLog.delete();
75: System.out.println("deleted derby.log ? " + deleted);
76:
77: System.out.println("End logStream");
78: } catch (Exception e) {
79: System.out.println("FAIL -- unexpected exception " + e);
80: JDBCDisplayUtil.ShowException(System.out, e);
81: e.printStackTrace();
82: }
83: }
84:
85: }
|