Code example for Connection

Methods: prepareStatement

0
import net.codjo.imports.server.plugin.ImportJobRequestHandler.ImportJobDao; 
 
class DefaultImportJobDao implements ImportJobDao { 
 
    public String getDestinationTable(Connection connection, String fileName) throws SQLException {
        SQLRequestBuilder sqlRequestBuilder = SQLRequestBuilderFactory.getSqlBuilder(connection);
        PreparedStatement statement = connection.prepareStatement(sqlRequestBuilder.getImportTable());
        try { 
            statement.setString(1, fileName);
 
            ResultSet resultSet = statement.executeQuery();
            if (resultSet.next()) {
                return resultSet.getString("DEST_TABLE");
            } 
        } 
        finally { 
            statement.close();
        } 
        return null; 
    } 
}