JDBC / NOTES</>↗JDBC30 May 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 / NOTES</>↗JDBC26 May 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 / NOTES</>↗Basic24 May 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 / NOTES</>↗Basic23 May 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 […]
JDBC / NOTES</>↗JDBC22 May 2010
The Statement.setQueryTimeout() method set the limit in seconds for query execution time. The execution has no timeout limit when the value is set to zero. package org.kodejava.jdbc; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.sql.SQLException; import java.sql.DriverManager; public class QueryTimeout { private static final String URL = "jdbc:mysql://localhost/kodejava"; private static final String USERNAME = "kodejava"; […]
CORE API / NOTES</>↗Core API22 May 2010
package org.kodejava.lang.management; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; public class PeakThreadCount { public static void main(String[] args) { // Get the managed bean for the thread system of the Java // virtual machine. ThreadMXBean bean = ManagementFactory.getThreadMXBean(); // Get the peak live thread count since the Java virtual // machine started or peak was reset. int peakThreadCount […]