I want to type a command with JDBC to create a table, but after first compilation, when table is already generated, every next one throws exception. I dont understand how is this possible, because I've put [IF NOT EXISTS] term there, so there should be no SQL error.
public class Test
{
public static void main(String[] args)
{
try
{
Connection conn = BazaDanych.Polacz();
Statement stat = conn.createStatement();
String command = "CREATE TABLE [IF NOT EXISTS] testowatabela2 (id INTEGER, wartosc DOUBLE PRECISION);";
stat.execute(command);
}
catch(SQLException e)
{
System.out.println("SQL Exception in Test");
}
}
}