java.sql.SQLException: No database selected – why?
Before you can add a table, you first have to select a database. you can create a new database with: CREATE DATABASE database_name you can connect to a specific database with: String url = “jdbc:mysql://localhost/databasename”; String username = “test”; String password = “test”; Connection connection = DriverManager.getConnection(url, username, password);