KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > backupRestore > Customer


1 package org.apache.derbyTesting.backupRestore;
2 import java.sql.*;
3
4 /**
5  * A Test class that modifies Customer table.
6  */

7
8 public class Customer
9 {
10
11   public static void addCustomer(int id, String JavaDoc name)
12     throws SQLException
13   {
14        Connection conn = DriverManager.getConnection("jdbc:default:connection");
15        PreparedStatement ps = conn.prepareStatement(
16          "insert into customer VALUES(?, ?)");
17
18        ps.setInt(1, id);
19        ps.setString(2, name);
20        ps.executeUpdate();
21        ps.close();
22        conn.close();
23   }
24 }
25
Popular Tags