The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.sql  [73 examples] > Tables  [6 examples]

e245. Creating a Database Table

This example creates a table called my_table with one column, col_string, which holds strings.
    try {
        Statement stmt = connection.createStatement();
    
        // Create table called my_table
        String sql = "CREATE TABLE my_table(col_string VARCHAR(254))";
    
        stmt.executeUpdate(sql);
    } catch (SQLException e) {
    }

 Related Examples
e246. Deleting a Database Table
e247. Listing All Table Names in a Database
e248. Creating a MySQL Table to Store Java Types
e249. Creating an Oracle Table to Store Java Types
e250. Creating a SQLServer Table to Store Java Types

See also: Batching    Connections    Database Meta Data    Deleting Data    Drivers    Importing and Exporting    Inserting and Updating Data    Oracle OBJECTs    Oracle VARRAYs    Procedures and Functions    Retrieving Data    Scrollable Result Sets    Updatable Result Sets   


© 2002 Addison-Wesley.