wood burning stoves 2.0*
The moose likes JDBC and the fly likes JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC" Watch "JDBC" New topic
Author

JDBC

Jimmy Lopez
Greenhorn

Joined: Mar 24, 2006
Posts: 9
Good day everyone, I am an entry level Java developer and I am trying to figure out this code;

public LinkedList selectEmployeeList(String department)
throws ServletException, WalgreensDataException, PMTException {

DataAccess da = null;
LinkedList employeeList = new LinkedList();
StringBuffer sqlQuery = new StringBuffer();
sqlQuery.append("select dept.auth_id, ");
sqlQuery.append("emp.first_name, ");
sqlQuery.append("emp.last_name, ");
sqlQuery.append("emp.active_ind, ");
sqlQuery.append("emp.task_ind, ");
sqlQuery.append("emp.project_ind ");
sqlQuery.append("from rts_employee emp, ");
sqlQuery.append("rts_emp_dept dept ");
sqlQuery.append("where emp.auth_id = dept.auth_id ");
sqlQuery.append("and dept.department = ? ");
sqlQuery.append("and dept.default_dept_ind = ? ");
sqlQuery.append("order by active_ind desc, emp.last_name");

da = new DataAccess(conn, sqlQuery.toString());
da.setSQL(sqlQuery.toString());
da.setString(1, department);
da.setString(2, PMTConstants.ACTIVE);

da.executeQuery();


while (da.next()) {
EmployeeBean emp = new EmployeeBean();
emp.setAuthId(da.getString("AUTH_ID"));
emp.setFirstName(da.getString("FIRST_NAME"));
emp.setLastName(da.getString("LAST_NAME"));
emp.setActiveInd(da.getString("ACTIVE_IND"));
emp.setTaskInd(da.getString("TASK_IND"));
emp.setProjectInd(da.getString("PROJECT_IND"));

employeeList.add(emp);
}

if (da != null) {
da.close();
}


return employeeList;
} // end of selectEmployeeList


Any suggestions ?
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333

I am trying to figure out this code;

Any suggestions ?


Ask a more specific question. Are you saying that this is your code and doesn't work? How not? Or is the code you found some where and you want to know what it does and how it works?

Here's a commented version (with a minor change or two); not the effect of using the code tags to make it more readable.


Hope that helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC