I would agree this is bad practice to have space in name but its not forbidden as others can say. the restrictions are documented here http://dev.mysql.com/doc/refman/5.0/en/identifiers.html and only a space at the end is forbidden
you can even mess with table names with space - for example the following works:
fhenri@machine:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.22 Homebrew
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database `db with space`;
Query OK, 1 row affected (0,00 sec)
mysql> use `db with space`;
Database changed
mysql> create table `table with space` (column1 VARCHAR(100) NOT NULL);
Query OK, 0 rows affected (0,03 sec)
mysql> select * from `table with space`;
Empty set (0,00 sec)
mysql>
From Java, you need to add the ` character (backtick character, not to confused with simple quote ')
String DBName = "`DB name 2015-02-01`";
DBName(with empty spaces)?executeUpdateis wrong ? thats how you create the db -int Result=statement.executeUpdate("CREATE DATABASE databasename");is clearly how you create the db from java. do not see whats wrong heresql - an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement.I have not read the second part about DDL statement. I wanted to edit my comment.