Java SQL ResultSet Double Read getDouble2(ResultSet rs, int index)

Here you can find the source of getDouble2(ResultSet rs, int index)

Description

get Double

License

Open Source License

Declaration

public static double getDouble2(ResultSet rs, int index) throws java.sql.SQLException 

Method Source Code


//package com.java2s;
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt

import java.sql.ResultSet;

public class Main {
    public static double getDouble2(ResultSet rs, int index) throws java.sql.SQLException {
        Double result = rs.getDouble(index);
        if (result == 0 && rs.getObject(index) == null) {
            throw new RuntimeException("Null value in non-Nullable column");
        }/* ww  w. jav  a  2 s. com*/
        return result;
    }

    public static double getDouble(ResultSet rs, int index) throws java.sql.SQLException {
        if (rs.getObject(index) != null) {
            return rs.getDouble(index);
        }

        throw new RuntimeException("Null value in non-Nullable column");
    }
}

Related

  1. getDouble(ResultSet resultSet, String columnName)
  2. getDouble(ResultSet rs, int index)
  3. getDouble(ResultSet rs, String colName)
  4. getDouble(ResultSet rs, String column)
  5. getDouble(ResultSet rs, String columnName)
  6. getDoubleList(ResultSet resultSet, String columnName)
  7. getDoubleNotZero(ResultSet rs, String columnLabel)
  8. getDoubleOrNanFromResultSet(ResultSet rs, int index)
  9. getDoubleOrNull(ResultSet rs, String columnName)