I get an Sqlexecption with this message "com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set."
So naturally the FIRST question you ask yourself was: Does my statement return a result set?
The answer to that question will tell you ONE of your problems.
I want to create a database and a table in sql server if it doesn't exist
You can't combine DML with DDL and you can't combine queries with SQL code.
1. execute a DML query to test if the objects exist.
2. in Java examine the result set from that query
3. if the objects do NOT exist then execute a DDL statement to create them.