SimpleViewerというところで公開している物は名前の通りシンプルにできているので個人的にも好きです。
そこで公開されているソースコードを使用するとFlickr上にある全世界に公開されている写真についているタグを集めて指定したタグの写真を表示させるサイトが構築できます。写真へのタグ付けはFlickrユーザーが独自に決めた物なので関連している情報と捉えるべきです。またタグは自分の好きなキーワードを指定できるので、とりあえず英語の名詞がたくさんあるだろうと予測して”wine”にしてみました。
2009年12月31日木曜日
2009年12月9日水曜日
JDBCドライバの接続確認
JDBCドライバとMySQLの接続テスト
public class Dbconnect {
public static void main(String args[]) {
Connection conn = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost/データベース名", "root", "パスワード入力");
System.out.println("MySQL と接続しました。");
} catch (SQLException e) {
System.out.println("MySQL との接続失敗");
System.out.println("SQLExceptionは " + e.getMessage());
System.out.println("SQLStateは " + e.getSQLState());
System.out.println("VendorError: " + e.getErrorCode());
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (conn != null) {
conn.close();
conn = null;
System.out.println("MySQLとの接続を切断しました");
}
} catch (Exception e) {
}
}
}
}
public class Dbconnect {
public static void main(String args[]) {
Connection conn = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost/データベース名", "root", "パスワード入力");
System.out.println("MySQL と接続しました。");
} catch (SQLException e) {
System.out.println("MySQL との接続失敗");
System.out.println("SQLExceptionは " + e.getMessage());
System.out.println("SQLStateは " + e.getSQLState());
System.out.println("VendorError: " + e.getErrorCode());
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (conn != null) {
conn.close();
conn = null;
System.out.println("MySQLとの接続を切断しました");
}
} catch (Exception e) {
}
}
}
}
登録:
投稿 (Atom)