creating a database in mysql from java

前端 未结 7 1942
情深已故
情深已故 2020-12-30 12:06

Could you help with this problem.

I\'m trying to create and then use a database called TIGER.

I have no problem if I create the database in MySQL and it runs

7条回答
  •  北海茫月
    2020-12-30 12:35

    You could always run

    int myResult = statement.executeUpdate("CREATE DATABASE IF NOT EXISTS TIGER;")
    

    If this is ran on project start up it will simply check if the database exists and if it doesn't it will create the new database.

    For reference: http://dev.mysql.com/doc/refman/5.0/en/create-database.html

提交回复
热议问题