Title: MyBatis create multiple tables for MySQL
Tags: mysql;sql;mybatis
Question: As you can imagine, 

```CREATE TABLE table1(id int);
CREATE TABLE table2(id int);
```

is easy executable on MySQL and on nearly every other SQL-Database.

This 

```<update id="test"&gt;
  CREATE TABLE table1(id int);
  CREATE TABLE table2(id int);
</update&gt;
```

is executable on MS SQL Server, but not on a MySQL-Database. Error:

```Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: 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 'CREATE TABLE table2(id int)' at line 2
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: CREATE TABLE table1(id int); CREATE TABLE table2(id int);
```

Any ideas, why this is the case?

EDIT:

```<update id="test"&gt;
  CREATE TABLE table(id int);
</update&gt;
```

.. is working everywhere.

EDIT for clarification:
My complete mybatis mapper.xml.

```<?xml version="1.0" encoding="UTF-8" ?&gt;
<!DOCTYPE mapper
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt;
 <mapper namespace="InitializationMapper"&gt;
   <update id="test"&gt;
      CREATE TABLE table1(id int);
      CREATE TABLE table2(id int);
   </update&gt;
</mapper&gt;
```

Comment: Edited. Now right before the question-mark. ;)

Comment: I don't use MyBatis Migrations therefore i don't have an environment.properties. Furthermore I cannot find any similar option in MyBatis anywhere..

Comment: http://stackoverflow.com/questions/23000085/mybatis-migrations-migrate-up-causes-org-apache-ibatis-jdbc-runtimesqlexception

`Setting send_full_script=false in enviornment.properties file fixes the problem.`

May find your answer there

Comment: Having never used MyBatis, but doing the little bit of research that I have, it looks to me that the problem occurs bc MySQL doesn't like the way it is passing it those DDL statements together in the script.

Also, from the examples I found, I couldn't anyone executing their DDL in this fashion. I wish I was able to help you.

Comment: Fine. But what's your question?

Here is the accepted answer: Try adding the "allowMultiQueries" option to the JDBC URL in your Mybatis config file, e.g.:

```jdbc:mysql://myserver/mydatabase?allowMultiQueries=true
```

It seemed to work for the folks over here: Multiple queries executed in java in single statement

Comment for this answer: It doesn't work for Oracle DB.

`url=jdbc:oracle:thin:@localhost:1521/testdb?allowMultiQueries=true` errors out in `IO Error: Invalid connection string format, a valid format is: "host:port:sid"`


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 5, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:08/26/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<mysql><sql><mybatis>', 'Title': 'MyBatis create multiple tables for MySQL', 'ViewCount': 2588, 'id': 32226250, 'user_AboutMe': '<p>So much wow.</p>\n', 'user_AccountId': 3154694.0, 'user_DisplayName': 'Simon K.', 'user_Reputation': 401.0, 'user_Views': 107.0, 'user_id': 2667366.0}}