JDBC / CATATAN</>↗JDBC03 Jun 2010
This example show you how to use the CallableStatement.wasNull() method call to see if the last OUT parameter has a value of SQL NULL. package org.kodejava.jdbc; import java.math.BigDecimal; import java.sql.Connection; import java.sql.CallableStatement; import java.sql.DriverManager; import java.sql.Types; import java.sql.SQLException; public class WasNullExample { private static final String URL = "jdbc:mysql://localhost/kodejava"; private static final String USERNAME = […]
BASIC / CATATAN</>↗Basic02 Jun 2010
To convert double value into an int value we can use type casting or using the Double.intValue() method call. The code snippet below show you how to do it. package org.kodejava.basic; public class DoubleToInt { public static void main(String[] args) { Double numberA = 49.99; System.out.println("numberA = " + numberA); // Converting Double value to […]
JDBC / CATATAN</>↗JDBC30 Mei 2010
This example show you how to call a stored procedure that return a result set of the query execution result. package org.kodejava.jdbc; import java.math.BigDecimal; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; public class CallableStatementExample { private static final String URL = "jdbc:mysql://localhost/kodejava"; private static final String USERNAME = "kodejava"; priv...
JDBC / CATATAN</>↗JDBC26 Mei 2010
This example show you how to register out parameter for executing a stored procedure using the CallableStatement.registerOutParameter() method call. We must register the out parameters before the query execution. The registerOutParameter() method takes two parameters, the index of the parameter and the sql data type of the out parameter. package org.kodejava.jdbc; import java.sql.*; public class […]
BASIC / CATATAN</>↗Basic24 Mei 2010
The unary operators requires only one operand to operate on, it can perform operations such as incrementing or decrementing value by one, negating a value or inverting a value of a boolean expression. The unary operators use the following symbols: Symbol Description + unary plus operator; indicates positive value – unary minus operator; negates a […]
BASIC / CATATAN</>↗Basic23 Mei 2010
The following example show you how to use Java arithmetic operators. The operators consist of the multiplicative operators (* for multiplication, / for division), % for remainder of division) and the additive operators (+ for addition,- for subtraction). You’ll also see we are using a combination of a simple assignment operator with the arithmetic operators […]