The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.sql  [73 examples] > Inserting and Updating Data  [4 examples]

e258. Inserting a Row into a Database Table

    try {
        Statement stmt = connection.createStatement();
    
        // Prepare a statement to insert a record
        String sql = "INSERT INTO my_table (col_string) VALUES('a string')";
    
        // Execute the insert statement
        stmt.executeUpdate(sql);
    } catch (SQLException e) {
    }

 Related Examples
e259. Inserting a Row into a Database Table Using a Prepared Statement
e260. Getting and Inserting Binary Data into an Database Table
e261. Updating a Row in a Database Table

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


© 2002 Addison-Wesley.