/****************************/
/* データベースへの接続 */
/* coded by Y.Suganuma */
/****************************/
import java.io.*;
import java.sql.*;
public class Test {
public static void main(String args[]) {
Connection Con;
// JDBCドライバの登録
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
}
catch (Exception e1) {
System.out.println("Driver Error: " + e1.toString());
}
// データベースへの接続
// getConnection(データベース名, ユーザ名, パスワード)
try {
Con = DriverManager.getConnection("jdbc:mysql://cs-www/mysql?" +
"useUnicode=true&characterEncoding=sjis", "xxxxx", "*****");
// +++++SQLの作成+++++
// ・・・・・
// 接続を切る
Con.close();
}
catch (SQLException e2) {
System.out.println("SQLException: " + e2.getMessage());
System.out.println("SQLState: " + e2.getSQLState());
System.out.println("VendorError: " + e2.getErrorCode());
}
}
}