Here you can find the source of prepareStatement(String query)
Parameter | Description |
---|---|
query | The SQL query statement that needs to be prepared. |
Parameter | Description |
---|---|
SQLException | The exception that can be thrown when the SQL queryfails. |
public static PreparedStatement prepareStatement(String query) throws SQLException
//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); } }