1 21 22 package org.apache.derbyTesting.functionTests.harness; 23 24 import java.sql.Connection ; 25 import java.sql.DriverManager ; 26 import java.sql.SQLException ; 27 import java.sql.SQLWarning ; 28 import java.util.*; 29 import java.io.*; 30 31 import org.apache.derby.tools.JDBCDisplayUtil; 32 33 41 public class shutdown 42 { 43 44 static String shutdownurl; 45 static String driver = "org.apache.derby.jdbc.EmbeddedDriver"; 46 static String systemHome; 47 48 public static void main(String [] args) throws SQLException , 49 InterruptedException , Exception 50 { 51 systemHome = args[0]; 52 shutdownurl = args[1]; 53 try 54 { 55 doit(); 56 } 57 catch(Exception e) 58 { 59 System.out.println("Exception in shutdown: " + e); 60 } 61 } 62 63 public static void doit() throws SQLException , 64 InterruptedException , Exception 65 { 66 Connection conn = null; 67 boolean finished = false; 68 Date d = new Date(); 69 70 Properties sp = System.getProperties(); 71 if (systemHome == null) 72 { 73 systemHome = sp.getProperty("user.dir") + File.separatorChar + 74 "testCSHome"; 75 sp.put("derby.system.home", systemHome); 76 System.setProperties(sp); 77 } 78 boolean useprocess = true; 79 String up = sp.getProperty("useprocess"); 80 if (up != null && up.equals("false")) 81 useprocess = false; 82 83 PrintStream stdout = System.out; 84 PrintStream stderr = System.err; 85 86 Class.forName(driver).newInstance(); 87 88 try 89 { 90 conn = DriverManager.getConnection(shutdownurl); 91 } 92 catch (SQLException se) 93 { 94 if (se.getSQLState().equals("08006")) 95 { 96 } 99 else 100 { 101 System.out.println("shutdown failed for " + shutdownurl); 102 JDBCDisplayUtil.ShowException(System.out, se); 103 System.exit(1); 104 } 105 } 106 } 107 } 108 | Popular Tags |