これはMySqlで動作します-
create database CarRentalCo;
use CarRentalCo;
create table LuxuryCars(rate varchar(5));
jdbcを使用してJavaで同じことをしようとしましたが、エラーが発生しました-
//Some code here
String query =
"create database CarRentalCo; "
"use CarRentalCo; "
"create table LuxuryCars(rate varchar(5)); "
//some code here
executeUpdate(query);
エラー:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'use CarRentalCo; create table LuxuryCars(rate varchar(5))' at line 1