Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Vector does not retain values in hashmap

807589Jul 15 2008 — edited Jul 17 2008
There should be 200 different values in Vector Group_Privs, but all the values is the last value retrieved. Help!

////////////////////////////////////////
Map map = new HashMap();
Vector Group_Privs = new Vector();
Database database = new Database();
ResultSet result = null;
String connection = Connection;
try
{
Connection con = database.getDesiredConnection(Connection);
PreparedStatement ps = null;
try
{
ps = con.prepareStatement("select GROUP_ID"
+" from group_table ");
result = ps.executeQuery();
int i=0;
while (result.next())
{
map.put ("GROUP_ID",(String)result.getString(1));
Group_Privs.add(map);
}
result.close();
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 14 2008
Added on Jul 15 2008
8 comments
182 views