Java SQL PreparedStatement prepareStatement(String query)

Here you can find the source of prepareStatement(String query)

Description

Prepares an SQL query statement to the database using the active database connection.

License

Open Source License

Parameter

Parameter Description
query The SQL query statement that needs to be prepared.

Exception

Parameter Description
SQLException The exception that can be thrown when the SQL queryfails.

Return

The prepared PreparedStatement that can be set and executed.

Declaration

public static PreparedStatement prepareStatement(String query) throws SQLException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.sql.Connection;

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

public class Main {
    private static Connection connection;

    /**//w ww.j av a 2 s .co m
     * Prepares an SQL query statement to the database using the active database
     * connection.
     *
     * @param query The SQL query statement that needs to be prepared.
     * @return The prepared PreparedStatement that can be set and executed.
     * @throws SQLException The exception that can be thrown when the SQL query
     * fails.
     */
    public static PreparedStatement prepareStatement(String query) throws SQLException {
        return connection.prepareStatement(query);
    }
}

Related

  1. prepareStatement(Connection connection, String line)
  2. prepareStatement(Connection connection, String sql, boolean returnKeys, Object... values)
  3. prepareStatement(Connection connection, String sql, Object... values)
  4. prepareStatement(String parameterizedSQL, List values, Connection conn)
  5. prepareStatement(String parameterizedSQL, List values, Connection conn)
  6. prepareStatementForwardReadOnly(Connection conn, String name, String sql)
  7. putArgsToStatement(PreparedStatement stmt, List args)
  8. query(List paramList, Connection conn, PreparedStatement pstmt)
  9. runInsertLong(PreparedStatement s)

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