Updated on 2023-08-31 GMT+08:00

Creating a Database

The following code snippet is provided in the createDatabase method of the Demo class in the com.huawei.clickhouse.examples packet. Run the on cluster statement to create a database whose name is the value of databaseName in Table 1 in the cluster.
private void createDatabase(String databaseName, String clusterName) throws Exception  {    
     String createDbSql = "create database if not exists " + databaseName + " on cluster " + clusterName;    
     util.exeSql(createDbSql);
}