get Object from ResultSet - Java JDBC

Java examples for JDBC:ResultSet

Description

get Object from ResultSet

Demo Code


//package com.java2s;
import java.io.IOError;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Main {
    public static <T> T getObject(ResultSet rs, int field) {
        try {/*from www.  j av  a 2  s .  c om*/
            return (T) rs.getObject(field);
        } catch (SQLException e) {
            throw new IOError(e);
        }
    }
}

Related Tutorials