1 Commits
main ... m-endo

Author SHA1 Message Date
m-endo
7cb48440b0 1段階目完了 2026-09-30 11:14:27 +09:00
8 changed files with 50 additions and 11 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/.metadata/

11
.project Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>em-jdbc</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

6
src/.classpath Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path=""/>
<classpathentry kind="output" path=""/>
</classpath>

17
src/.project Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>src</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1 @@
/EmployeeDAO.class

View File

@@ -0,0 +1 @@
/Main.class

View File

@@ -0,0 +1 @@
/DbUtil.class

View File

@@ -35,7 +35,7 @@ public class DbUtil {
/* /*
* TODO 以下の仕様でメソッドを作成してください。 * TODO 以下の仕様でメソッドを作成してください。
*1,2をやる *
* 戻り値 :Connection * 戻り値 :Connection
* メソッド名 :getConnection * メソッド名 :getConnection
* 引数 :なし * 引数 :なし
@@ -52,33 +52,34 @@ public class DbUtil {
/* /*
* TODO 以下の仕様でメソッドを作成してください。 * TODO 以下の仕様でメソッドを作成してください。
*6をやる *
* 戻り値 :なし * 戻り値 :なし
* メソッド名 :closeStatement * メソッド名 :closeStatement
* 引数 :DBステートメント(PreparedStatement型) * 引数 :DBステートメント(PreparedStatement型)
* 例外 :SQLException * 例外 :SQLException
* 処理 :引数のDBステートメントがnullでない場合、そのDBステートメントをクローズする * 処理 :引数のDBステートメントがnullでない場合、そのDBステートメントをクローズする
*/ */
public static void closeStatement(PreparedStatement ps) throws SQLException { public static void closeStatement(PreparedStatement stmt) throws SQLException {
if (ps != null) { //nullチェック
ps.close(); if (stmt != null) {
stmt.close();
} }
} }
/* /*
* TODO 以下の仕様でメソッドを作成してください。 * TODO 以下の仕様でメソッドを作成してください。
*7 *
* 戻り値 :なし * 戻り値 :なし
* メソッド名 :closeConnection() * メソッド名 :closeConnection()
* 引数 :切断するコネクション(Connection型) * 引数 :切断するコネクション(Connection型)
* 例外 :SQLException * 例外 :SQLException
* 処理 :引数のコネクションがnullでない場合、そのコネクションを切断する * 処理 :引数のコネクションがnullでない場合、そのコネクションを切断する
*/ */
public static void closeConnection(Connection co) throws SQLException { public static void closeConnection(Connection con) throws SQLException {
if (co != null) { //nullチェック
co.close(); if (con != null) {
} con.close();
} }
} }
}