Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

[b][u]JSP/mySQL CREATE DATABASE problem[/u][/b]

843840Aug 14 2007 — edited Nov 20 2007
I 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 18 2007
Added on Aug 14 2007
9 comments
146 views