how i create a connector that contains an mysql query and the result be saved in java.lang.long variable?

Hi evrybody,

i have this code that allow to retrieve the “id” and “name” of user, but the results are stored in java.util.HashMap variable , i just want to store the results into java.lang.long variable instead of java.utilHashMap.

the code is:

HashMap<String,String> hm= new HashMap<String,String>();

resultset.beforeFirst();
while (resultset.next()) {
String nom = resultset.getString(‘userName’);
String id = resultset.getString(‘id’);
hm.put(id,name);
}
return hm;

Regards

resultset.beforeFirst();
Long id = null;
if (resultset.next()) {
id = resultset.getLong(‘id’);
}
return id;

It returns the first id if you have a result and it returns null instead.

Thank you so much yannick :slight_smile:
¿have you got a good groovy manual to try learn?

I don’t use Groovy. This code is java.

Groovy is here:

http://www.groovy-lang.org/

there are links there for books etc.

regards