- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
symbol barcode reader c# example PASSING INPUT PARAMETERS TO PREPAREDSTATEMENT in Font
CHAPTER 13 PASSING INPUT PARAMETERS TO PREPAREDSTATEMENT Make PDF 417 In None Using Barcode printer for Font Control to generate, create PDF-417 2d barcode image in Font applications. www.OnBarcode.comData Matrix 2d Barcode Encoder In None Using Barcode drawer for Font Control to generate, create DataMatrix image in Font applications. www.OnBarcode.comID -------id-1 id-2 Painting UPC Code In None Using Barcode creator for Font Control to generate, create GS1 - 12 image in Font applications. www.OnBarcode.comCode 39 Full ASCII Encoder In None Using Barcode printer for Font Control to generate, create ANSI/AIM Code 39 image in Font applications. www.OnBarcode.comDATE_COLUMN -------------12-JUN-03 12-DEC-03 GS1 128 Encoder In None Using Barcode encoder for Font Control to generate, create UCC-128 image in Font applications. www.OnBarcode.comEncode Barcode In None Using Barcode maker for Font Control to generate, create Barcode image in Font applications. www.OnBarcode.comRunning the Solution for the Oracle Database
Code 128 Code Set B Printer In None Using Barcode maker for Font Control to generate, create Code 128 Code Set A image in Font applications. www.OnBarcode.comBritish Royal Mail 4-State Customer Code Creation In None Using Barcode drawer for Font Control to generate, create British Royal Mail 4-State Customer Barcode image in Font applications. www.OnBarcode.comThis shows how to run the solution for the Oracle database: $ javac Demo_PreparedStatement_SetDate.java $ java Demo_PreparedStatement_SetDate oracle id-200 --Demo_PreparedStatement_SetDate begin-conn=oracle.jdbc.driver.OracleConnection@6e70c7 --------------rowCount=1 --Demo_PreparedStatement_SetDate end-$ java Demo_PreparedStatement_SetDate oracle id-400 --Demo_PreparedStatement_SetDate begin-conn=oracle.jdbc.driver.OracleConnection@6e70c7 --------------rowCount=1 --Demo_PreparedStatement_SetDate end-- PDF-417 2d Barcode Creator In None Using Barcode creator for Office Excel Control to generate, create PDF-417 2d barcode image in Microsoft Excel applications. www.OnBarcode.comPDF417 Encoder In Visual Basic .NET Using Barcode generator for VS .NET Control to generate, create PDF-417 2d barcode image in .NET applications. www.OnBarcode.comViewing the Oracle Database After Running the Solution
Painting UPC Code In Visual Basic .NET Using Barcode maker for .NET framework Control to generate, create Universal Product Code version A image in .NET framework applications. www.OnBarcode.comGS1 - 12 Drawer In Java Using Barcode generation for Java Control to generate, create UPC Code image in Java applications. www.OnBarcode.comThis shows the Oracle database after running the solution: SQL> select * from date_table; ID DATE_COLU ---------------id-1 12-JUN-03 id-2 12-DEC-03 id-200 07-NOV-03 id-400 07-NOV-03 Code 128 Encoder In Java Using Barcode generator for Java Control to generate, create Code 128A image in Java applications. www.OnBarcode.comPainting Matrix In Visual Basic .NET Using Barcode maker for Visual Studio .NET Control to generate, create Matrix 2D Barcode image in Visual Studio .NET applications. www.OnBarcode.comSetting Up the MySQL Database
Recognizing EAN 13 In VB.NET Using Barcode scanner for .NET Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comPrint Code 128 Code Set B In Java Using Barcode generator for Android Control to generate, create Code128 image in Android applications. www.OnBarcode.comUsing Oracle, define a table that has a column of the DATE type, as shown next. The Oracle database accepts dates in the dd-MMM-yyyy format, while the MySQL database accepts dates in the yyyy-mm-dd format. mysql> create table date_table(id VARCHAR(12), date_column DATE); Query OK, 0 rows affected (0.14 sec) mysql> desc date_table; +-------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ | id | varchar(12) | YES | | NULL | | | date_column | date | YES | | NULL | | +-------------+-------------+------+-----+---------+-------+ 2 rows in set (0.06 sec) mysql> insert into date_table(id, date_column) values('id-1', '12-JUN-2003'); Query OK, 1 row affected (0.01 sec) mysql> insert into date_table(id, date_column) values('id-2', '12-DEC-2003'); Create QR-Code In None Using Barcode generator for Excel Control to generate, create QR image in Office Excel applications. www.OnBarcode.comQR Code 2d Barcode Generation In C#.NET Using Barcode creation for Visual Studio .NET Control to generate, create QR Code 2d barcode image in Visual Studio .NET applications. www.OnBarcode.comCHAPTER 13 PASSING INPUT PARAMETERS TO PREPAREDSTATEMENT
Drawing EAN / UCC - 13 In Java Using Barcode generator for Java Control to generate, create EAN / UCC - 14 image in Java applications. www.OnBarcode.comPDF 417 Creator In Java Using Barcode maker for BIRT Control to generate, create PDF 417 image in BIRT reports applications. www.OnBarcode.comQuery OK, 1 row affected (0.00 sec) mysql> select * from date_table; +------+-------------+ | id | date_column | +------+-------------+ | id-1 | 0000-00-00 | | id-2 | 0000-00-00 | +------+-------------+ 2 rows in set (0.13 sec) mysql> insert into date_table(id, date_column) values('id-3', '2003-06-12'); mysql> insert into date_table(id, date_column) values('id-3', '2003-12-12'); mysql> select * from date_table; +------+-------------+ | id | date_column | +------+-------------+ | id-1 | 0000-00-00 | | id-2 | 0000-00-00 | | id-3 | 2003-06-12 | | id-4 | 2003-12-12 | +------+-------------+ 4 rows in set (0.00 sec) Running the Solution for the MySQL Database
This shows how to run the solution for the MySQL database: $ javac Demo_PreparedStatement_SetDate.java $ java Demo_PreparedStatement_SetDate mysql id-300 --Demo_PreparedStatement_SetDate begin-conn=com.mysql.jdbc.Connection@cd2c3c --------------rowCount=1 --Demo_PreparedStatement_SetDate_MySQL end-$ java Demo_PreparedStatement_SetDate mysql id-500 --Demo_PreparedStatement_SetDate begin-conn=com.mysql.jdbc.Connection@cd2c3c --------------rowCount=1 --Demo_PreparedStatement_SetDate_MySQL end-- Viewing the MySQL Database After Running the Solution
This shows the MySQL database after running the solution: mysql> select * from date_table; +--------+-------------+ | id | date_column | +--------+-------------+ | id-1 | 0000-00-00 | | id-2 | 0000-00-00 | | id-3 | 2003-06-12 | | id-4 | 2003-12-12 | | id-300 | 2003-11-07 | | id-500 | 2003-11-07 | +--------+-------------+ 6 rows in set (0.00 sec) CHAPTER 13 PASSING INPUT PARAMETERS TO PREPAREDSTATEMENT
13-13. How Do You Use PreparedStatement s setFloat() and setDouble() The following sections show how to pass a floating-point value (the Java primitive data types float and double) to a PreparedStatement object. How It Works
You can use the PreparedStatement object s setFloat() and setDouble() methods on both the Oracle and MySQL databases. In Oracle, when a column data type is NUMBER, then you can use setFloat() and setDouble(). Oracle uses the NUMBER type for integers and floating-point numbers. In MySQL, when a column data type is FLOAT, REAL, DOUBLE PRECISION, NUMERIC, or DECIMAL, then you can use setFloat() and setDouble(). The signature of setDouble() is as follows: public void setDouble(int parameterIndex, double x) throws SQLException This sets the designated parameter to the given Java double value. The driver converts this to a SQL DOUBLE value when it sends it to the database. The parameters are as follows: parameterIndex: The first parameter is 1, the second is 2, and so on. x: The parameter value. This throws a SQLException if a database access error occurs. The signature of setFloat() is as follows: public void setFloat(int parameterIndex, float x) throws SQLException This sets the designated parameter to the given Java float value. The driver converts this to a SQL FLOAT value when it sends it to the database. The parameters are as follows: parameterIndex: The first parameter is 1, the second is 2, and so on. x: The parameter value. This throws a SQLException if a database access error occurs.
|
|