Hello there -
I would like to create a new database from a JSP (connecting to a
mySQL database, running Apache and Tomcat 4.1.24) - Is this possible?
I've poked around on newsgroups etc but have not been able to find a
suitable answer.
Can I create a database directly, or perhaps call some sort of script?
I am rather new to all of this, so if you know what that script might
look like I'd really appreciate the code.
Here is what I've tried so far: (i found this code on a newsgroup and
modified it slightly. it results in a "No suitable driver" error)
String tmpdbURL="jdbc:mysql://server";
Class.forName("org.gjt.mm.mysql.Driver");
java.sql.Connection tmpCon = null;
tmpCon = java.sql.DriverManager.getConnection(tmpdbURL, <user>,
<pwd>);
java.sql.Statement tmpStmt = null;
tmpStmt = tmpCon.createStatement();
tmpStmt.executeUpdate("CREATE DATABASE testuser31"); // + i +";");
tmpStmt.close();
tmpCon.close();
Thank you so much for any insight!
=)Caroline