|
-
October 4th, 1999, 03:44 AM
#1
creating DB's in mySQL
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
-
October 4th, 1999, 11:14 AM
#2
Re: creating DB's in mySQL
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...
-
October 5th, 1999, 02:35 AM
#3
Re: creating DB's in mySQL
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
-
October 5th, 1999, 07:31 AM
#4
Re: creating DB's in mySQL
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();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|