KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > functionTests > tests > lang > logStream


1 /*
2
3    Derby - Class org.apache.derbyTesting.functionTests.tests.lang.logStream
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.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 JavaDoc args[])
37   {
38     try {
39         System.out.println("Start logStream");
40         /* Load the JDBC Driver class */
41         // use the ij utility to read the property file and
42
// make the initial connection.
43
ij.getPropertyArg(args);
44         Connection conn = ij.startJBMS();
45
46         conn.close();
47
48         String JavaDoc systemHome = System.getProperty("derby.system.home");
49
50         File derbyLog = new File(systemHome, "derby.log");
51
52         System.out.println("derby.log exists ? " + derbyLog.exists());
53         System.out.println("derby.log is directory ? " + derbyLog.isDirectory());
54         System.out.println("derby.log has content ? " + (derbyLog.length() > 0));
55
56         System.out.println("SHUTDOWN Derby");
57         try {
58             TestUtil.getConnection("","shutdown=true");
59             System.out.println("FAIL - shutdown returned connection");
60         } catch (SQLException sqle) {
61             System.out.println("SHUTDOWN :" + sqle.getMessage());
62         }
63
64         System.out.println("derby.log exists ? " + derbyLog.exists());
65         System.out.println("derby.log is directory ? " + derbyLog.isDirectory());
66         System.out.println("derby.log has content ? " + (derbyLog.length() > 0));
67
68         boolean deleted = derbyLog.delete();
69         System.out.println("deleted derby.log ? " + deleted);
70
71         System.out.println("End logStream");
72     } catch (Exception JavaDoc e) {
73         System.out.println("FAIL -- unexpected exception "+e);
74         JDBCDisplayUtil.ShowException(System.out, e);
75         e.printStackTrace();
76     }
77   }
78
79 }
80
Popular Tags