Sto cercando di creare un programma con Java dove collego GUI a MySQL.
    public static void creaTabella() {
        try {
            Connection con = getConnection();
            PreparedStatement crea = con.prepareStatement(
                     "CREATE DATABASE IF NOT EXISTS db;"
                    + "USE db;"
                    + "CREATE TABLE IF NOT EXISTS tabella"
                    + "(codice_articolo INT NOT NULL AUTO_INCREMENT,"
                    + "descrizione VARCHAR(255),"
                    + "quatita int,"
                    + "prezzo DOUBLE(12,2),"
                    + "totale DOUBLE(12,2),"
                    + "scadenza DATE,"
                    + "PRIMARY KEY(codice_articolo));");
            crea.executeUpdate();
        } catch (Exception e) {
            System.out.println(e);
        }
    }
Quando avvio il programma questo è quello che stampa:
Connected
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USE db;CREATE TABLE IF NOT EXISTS tabella(codice_articolo INT NOT NULL AUTO_I...' at line 1
Che cosa ho fatto che non va? Grazie...