Hi everyone,
Is it possible to create a database from java (e.g name supplied by the user at the beginning instead using a pre-created or a dummy one) ?It seems that I have to connect to an already existing database before executing any statement (look at the following codes).
| Code: |
public void createDatabase(String DBName) throws Exception { Connection conn;
Statement st=null;
ResultSet rs=null;
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost/ttdatabase"); // look at this line
st = conn.createStatement();
. . .
. . .
|
_________________
Keep your own dignity, both online and offline throughout your life !!!