[b][u]JSP/mySQL CREATE DATABASE problem[/u][/b]
843840Aug 14 2007 — edited Nov 20 2007I am trying to create a mySQL DB through JSP program (query).
The Query :
stmt.executeUpdate("CREATE DATABASE employee;");
is not working. PLEASE HELP ME.................
The program is as follows.
try
{
Connection con =null;
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/bedrock","Dude","");
System.out.println("Connection Established");
try {
System.out.println("Entered Try Block");
stmt=con.createStatement();
stmt.executeUpdate("CREATE DATABASE employee;");
System.out.println("Query Executed");
}
catch(Exception e){
System.out.println("Entered Catch Block");
System.out.println("Query Skipped");
}
catch (SQLException ex)
{
while (ex != null){
System.out.println("sql exception"+ex);
ex = ex.getNextException ();
}
}
Message was edited by:
sam_john