Can there be any possability to produce a database within mysql from java.
I am only conscious of the
String url="jdbc:mysql://localhost:3306/test"; Connection con = DriverManager.getConnection( url, "cb0", "xxx" );
syntax but here you need to specify a database title within the 'url'.
But how do you produce a mysql database after i have only a login title and password, but no understanding concerning the existing databases ?
The database is not needed within the jdbc connection, so that you can make a move like suggested at http://forums.mysql.com/read.php?39,99321,102211#msg-102211 and http://marc.info/?l=mysql-java&m=104508605511590&w=2:
Conn = DriverManager.getConnection ("jdbc:mysql://localhost/?user=root&password=rootpassword"); s=Conn.createStatement(); int Result=s.executeUpdate("CREATE DATABASE databasename");
Make default database to
mysql. Next, create database you'll need making it default using command [cde]
To create things even simpler, you should use NetBeans 6.5 also it makes establishing SQL databases A lot simpler. I am with them at this time and it is a lifesaver on GUI designs and database connections. Here's some code how I connect with my sql database from NetBeans:
A stylish method of such issues is applying DDL Utils from Apache. Not just wouldn't it serve the fundamental reason for permitting to complete your (externally configurable) DDLs, but additionally will make the application database independent.