1/**
2 * Copyright(C) 2004
3 * All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
4 *
5 * Permission to use, copy, modify, and distribute this
6 * software and its documentation for EDUCATIONAL purposes
7 * and without fee is hereby granted provided that this
8 * copyright notice appears in all copies.
9 *
10 * @date : January 1, 2004.
11 * @author : Salih Yurttas.
12 */
13
14
15import dbops.DBConnect;
16import dbops.DBTable;
17
18import java.sql.*;
19import java.net.*;
20
21public class DBUpdate10 {
22
23 private static String driverClass = "com.mysql.jdbc.Driver",
24 url = "jdbc:mysql:",
25 suffix = "//localhost/bank";
26
27 private static Connection con;
28
29 private static String urlDB = url + suffix + ".";
30
31 public static void main (String[] args) {
32 String username = args[0];
33 String password = args[1];
34
35 DBConnect dbc = new DBConnect();
36
37 try {
38 if(dbc.connect(args[0], args[1])) {
39 System.out.println("Connected to " + urlDB);
40
41 con = dbc.getConnect();
42
43 DBTable dbUpdate = new DBTable(con);
44
45 String updateA1 = "UPDATE AA SET itemB = 'B0';";
46
47 if(dbUpdate.setStatement(updateA1))
48 System.out.println("Table AA is updated into " + urlDB);
49 if(dbc.disconnect(con))
50 System.out.println("Disconnected from " + urlDB);
51 }
52 else System.out.println("Could not connect to " + urlDB);
53 }
54 catch(SQLException sqle) {
55 System.err.println("Error accessing " + urlDB);
56 System.err.println(sqle.getMessage());
57 }
58 }
59
60}