Java SQL PreparedStatement getPreparedStatement(Connection conn, String sql)

Here you can find the source of getPreparedStatement(Connection conn, String sql)

Description

get Prepared Statement

License

Apache License

Declaration

public static PreparedStatement getPreparedStatement(Connection conn,
            String sql) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.sql.Connection;

import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.mysql.jdbc.Statement;

public class Main {
    public static PreparedStatement getPreparedStatement(Connection conn,
            String sql) {/*from  w  w  w. j  a v  a  2s. c  o m*/
        try {
            return conn.prepareStatement(sql,
                    Statement.RETURN_GENERATED_KEYS);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return null;
    }
}

Related

  1. getGenerateKey(PreparedStatement stmt)
  2. getIdentity(PreparedStatement stat)
  3. getLastId(PreparedStatement s)
  4. getLimitedBatchSizePreparedStatement(PreparedStatement pstmt, int maxBatchSize)
  5. getNewPreparedStatement(String format)
  6. getPreparedStatement(Connection conn, String sql, List sqlParams, boolean getGeneratedKeys)
  7. getPreparedStatement(String sql)
  8. getPriorID(Connection conn, PreparedStatement stmt)
  9. getScalarValue(PreparedStatement ps)

  10. HOME | Copyright © www.java2s.com 2016