Click to See Complete Forum and Search --> : creating DB's in mySQL
jmich
October 4th, 1999, 03:44 AM
I would like to create an applet wich retrieves information from a mySQL-database.
I downloaded mySQL and a class IV driver, but I can't figure out how to create a database.
Could anyone help me ?
Jesper
poochi
October 4th, 1999, 11:14 AM
I dont know about mySQL and class IV driver. but i hope the SQL statement is common for
all database and drivers.
> how to create a database
CREATE DATABASE Test
ON (NAME = TestData, // Logical Name of the Database
FILENAME = 'e:\mssql7\data\TestData.mdf', // Physical file name
SIZE = 100MB,
MAXSIZE = 200,
FILEGROWTH = 20)
> retrieves information from a mySQL-database
You have to run a specific System Stored Procedures to get the information about the database.
( Some are : sp_tables , sp_columns , ... )
In java , do the following to call the stored procedure.
CallableStatement tCallableStatement = tDBConnection.prepareCall( "sp_table" );
ResultSet tResultSet = tCallableStatement.executeQuery();
Now manipulate with the ResultSet object to get the information about the tables in
a particular database.
Poochi...
jmich
October 5th, 1999, 02:35 AM
Hi Poochi - thanks for responding !
I just wondered - the 'CREATE DATABASE Test...' part of the code you send me is not supposed to be type into a java-app, but rather in a SQL-program, right ?
Jesper
poochi
October 5th, 1999, 07:31 AM
Yes , it's a SQL Statement. You can use it in java .. Try like this..
String SQLString = "CREATE DATABASE ...... "
Statement tStatement = m_tDBConnection.createStatement();
tStatement.executeUpdate( SQLString );
tStatement.close();
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.