Shutting down or creating a database If you need to shut down or create a database, it is easiest just to work with the -specific implementations of interfaces, as shown in these examples. javax.sql.XADataSource xads = makeXADataSource(mydb, true); // example of setting property directory using // 's XADataSource object import org.apache.derby.jdbc.EmbeddedXADataSource; import javax.sql.XADataSource; // dbname is the database name // if create is true, create the database if not already created XADataSource makeXADataSource (String dbname, boolean create) { EmbeddedXADataSource xads = new EmbeddedXADataSource(); // use 's setDatabaseName call xads.setDatabaseName(dbname); if (create) xads.setCreateDatabase("create"); return xads; }

Setting the property does not create or shut down the database. The database is not actually created or shut down until the next connection request.