1 19 package com.mysql.jdbc; 20 21 import java.sql.SQLException ; 22 23 import java.util.Properties ; 24 25 26 31 public class MiniAdmin { 32 private Connection conn; 33 34 41 public MiniAdmin(java.sql.Connection conn) throws SQLException { 42 if (conn == null) { 43 throw new SQLException ("Conection can not be null.", SQLError.SQL_STATE_GENERAL_ERROR); 44 } 45 46 if (!(conn instanceof Connection)) { 47 throw new SQLException ("MiniAdmin can only be used with MySQL connections", 48 SQLError.SQL_STATE_GENERAL_ERROR); 49 } 50 51 this.conn = (Connection) conn; 52 } 53 54 62 public MiniAdmin(String jdbcUrl) throws SQLException { 63 this(jdbcUrl, new Properties ()); 64 } 65 66 75 public MiniAdmin(String jdbcUrl, Properties props) 76 throws SQLException { 77 this.conn = (Connection) (new Driver().connect(jdbcUrl, props)); 78 } 79 80 86 public void shutdown() throws SQLException { 87 conn.shutdownServer(); 88 } 89 } 90 | Popular Tags |