Execute SQL via Statement - Java java.sql

Java examples for java.sql:Statement

Description

Execute SQL via Statement

Demo Code


//package com.java2s;

import java.sql.ResultSet;

import java.sql.SQLException;
import java.sql.Statement;

public class Main {

    public static ResultSet execSQL(Statement stat, String sql)
            throws SQLException {
        ResultSet rs = null;//from  www  .  ja va  2 s .  co m
        //System.out.println(sql);
        if (stat.execute(sql)) {
            rs = stat.getResultSet();
        }
        return rs;
    }
}

Related Tutorials