基本的なデータベースアクセス方法の問題 Javaから一般的なリレーショナルデータベース(以下、データベースと呼称)にアクセスするには、以下に示すようにjava.sqlパッケージのConnection、Statement、ResultSetを使うのが基本です。 InitialContext init = new InitialContext( ); DataSource ds = (DataSource)init.lookup("java:comp/env/jdbc/TestDB"); Connection con = ds.getConnection(); Statement st = con.createStatement(); ResultSet rs = st.executeQuery("select * from items;"); ……// rsから結果を取得 rs.close(