1 27 28 29 package org.webdocwf.util.loader.test; 30 31 import java.sql.Connection ; 32 import java.sql.Statement ; 33 import org.webdocwf.util.loader.test.DatabaseOperation; 34 import org.webdocwf.util.loader.Loader; 35 import org.webdocwf.util.loader.LoaderException; 36 37 import java.sql.SQLException ; 38 39 45 public class CreateDatabaseOperation extends DatabaseOperation 46 { 47 48 private String databaseName=null; 49 50 CreateDatabaseOperation() 51 { 52 } 53 54 55 public CreateDatabaseOperation(String name) 56 { 57 databaseName=name; 58 } 59 60 63 69 70 public void execute(Connection conn) throws SQLException 71 { 72 Statement stmt = conn.createStatement(); 73 if(databaseName!=null){ 74 try 75 { 76 stmt.execute("CREATE DATABASE "+databaseName); 77 } 78 finally 79 { 80 stmt.close(); 81 } 82 } 83 } 84 85 86 90 public String getDatabaseOperationType() 91 { 92 return DatabaseOperation.CREATE; 93 } 94 95 96 } 97 98 99 100 101 102 103 104 | Popular Tags |