SQL login method

4

I have the following scheme:

JdbcRowSet myrs = new JdbcRowSetImpl();

myrs.setUrl("jdbc:postgresql://localhost:9999/teste");
myrs.setUsername("postgres");
myrs.setPassword("");
myrs.setCommand("select count (*) from pessoas where cpf = '12345'");
myrs.execute();

ResultSetMetaData md = myrs.getMetaData();
String columncount = //Exemplo: getColumnName(1);

if ( columncount == 12345){
    return ("existe");  
} if ( columncount != 12345){
    return ("inexiste");
}

Does anyone know the method that would apply in place of // Example to capture the contents of column "cpf" for purposes of confirming the existence of cpf "12345"?

    
asked by anonymous 13.08.2014 / 04:56

1 answer

3

Have you tried myrs.getString(1) ? It should work. Oh, and if columnCount is String, the expression columnCount == 12345 and != will fail. This post seems to use this solution, it might be useful for you. link

    
13.08.2014 / 19:42