1 package com.instantbank.collections.ach;
2
3 import java.sql.Connection;
4 import java.sql.PreparedStatement;
5 import java.sql.ResultSet;
6 import java.sql.SQLException;
7 import com.instantbank.collections.util.DataAccess;
8 import com.instantbank.collections.util.InstantbankException;
9 import com.instantbank.collections.util.SqlUtil;
10
11 public class SystemDAO extends Object {
12 public SystemDAO() {
13 super();
14 }
15
16
17 private static final String RETRIEVE_SYSTEM_DESC =
18 "SELECT system_desc "
19 + "FROM system "
20 + "WHERE system_id= ? ";
21
22
23
24 public static String retrieveSystemDesc(long systemId)
25 throws InstantbankException, SQLException {
26 Connection con = null;
27 PreparedStatement ps = null;
28 ResultSet rs = null;
29 DataAccess da = new DataAccess();
30 String systemid = " ";
31
32 try {
33 da.connect();
34 con = da.getConnection();
35 ps = con.prepareStatement(RETRIEVE_SYSTEM_DESC);
36
37 ps.setLong(1, systemId);
38 rs = ps.executeQuery();
39 if(rs != null && rs.next()) {
40 systemid = rs.getString(1);
41
42 }
43 }
44 catch(Exception e) {
45 e.printStackTrace();
46 throw new InstantbankException(e, "813000", "Error searching for System Id Description");
47 }
48 finally {
49 SqlUtil.release(da.getConnection(), ps, rs);
50 }
51
52 return systemid;
53 }
54
55 }
56