Help Center/ MapReduce Service/ Developer Guide (LTS)/ Doris Development Guide (Security Mode)/ Doris Application Development/ Doris JDBC API Invoking Sample Program/ Creating a Doris Database
Updated on 2026-06-29 GMT+08:00
Creating a Doris Database
This section describes the sample code for creating a Doris database.
The following code snippet is in the JDBCExample class.
Run the SQL statement in Java JDBC mode to create the database corresponding to the dbName variable in the cluster.
String createDatabaseSql = "create database if not exists " + dbName;
public static void execDDL(Connection connection, String sql) throws Exception {
try (PreparedStatement statement = connection.prepareStatement(sql)) {
statement.execute();
} catch (Exception e) {
logger.error("Execute sql {} failed.", sql, e);
throw new Exception(e);
}
} Parent topic: Doris JDBC API Invoking Sample Program
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot