C
cleanair4me
In Tomcat 6.0.20 I am attempting to create an Oracle 9i resultset that
outputs as a String array and need help creating the method.
The CityData method will be called in the CityServlet:
String [] cityArray = cityData.getCityList();
Please help me with my attempt in the CityData class. Here is what I
have so far and not sure how to get a String array resultset.
public ArrayList<String> getCityList()
{
try {
//resultset, stmt and sql here....
//................
ArrayList<String> citys = new ArrayList<String>();
while(rs.next())
{
citys.add(rs.getString("city"));
}
String [] cityArray = citys.toArray(new
String[citys.size()]);
}
return cityArray;
}
outputs as a String array and need help creating the method.
The CityData method will be called in the CityServlet:
String [] cityArray = cityData.getCityList();
Please help me with my attempt in the CityData class. Here is what I
have so far and not sure how to get a String array resultset.
public ArrayList<String> getCityList()
{
try {
//resultset, stmt and sql here....
//................
ArrayList<String> citys = new ArrayList<String>();
while(rs.next())
{
citys.add(rs.getString("city"));
}
String [] cityArray = citys.toArray(new
String[citys.size()]);
}
return cityArray;
}