Book Contents

Book Index

Next Topic

Home

Prepared Statements in ODBC/JDBC

Note to reviewers: More complete documentation for the ODBC and JDBC drivers is being planned. This Release Notes section deals only with prepared statements.

Vertica now supports prepared statements in both the ODBC and JDBC drivers.

ODBC Driver

ODBC Example

 

SQLPrepare(hstmt,

"UPDATE Parts SET Price = ? WHERE PartID = ?", SQL_NTS);

SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT,

SQL_C_FLOAT, SQL_REAL, 7, 0, &Price, 0, &PriceInd);

SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT,

SQL_C_ULONG, SQL_INTEGER, 10, 0, &PartID, 0, &PartIDInd);

SQLExecute(hstmt);

JDBC Driver

The following functionality is now supported in the JDBC driver:

JDBC Example

 

PreparedStatement pst = dbconn.prepareStatement(

"select * from fact where type=?");

pst.setString(1, "trades");

ResultSet rs = pst.executeQuery();

JDBCSetupTest.printResults(rs, resultStream);

Notes

For More Information

See the following sections of the SQL Programmer's Guide: