JDBC / NOTES</>↗JDBC24 Feb 2008
package org.kodejava.jdbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.DatabaseMetaData; import java.sql.SQLException; public class BatchSupportChecker { private static final String URL = "jdbc:mysql://localhost/kodejava"; private static final String USERNAME = "kodejava"; private static final String PASSWORD = "s3cr*t"; public static void main(String[] args) { try (Connection connection = DriverManager.getConnection(URL, USERNAME, PASSWORD)) {...
BASIC / NOTES</>↗Basic24 Feb 2008
package org.kodejava.basic; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class TypeSpecificCollection { public static void main(String[] args) { // Using a Generic can enable us to create a type specific collection // object. In the example below we create a Map whose key is an Integer // a have the value of a […]
CORE API / NOTES</>↗Core API21 Feb 2008
package org.kodejava.util; import java.util.TimeZone; public class TimezonesExample { public static void main(String[] args) { String[] availableTimezones = TimeZone.getAvailableIDs(); for (String timezone : availableTimezones) { System.out.println("Timezone ID = " + timezone); } } } Some examples of the returned timezones ids are: Timezone ID = Etc/GMT+12 Timezone ID = Etc/GMT+11 Timezone ID = MIT Timezone ID […]
JDBC / NOTES</>↗JDBC19 Feb 2008
package org.kodejava.jdbc; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Connection; import java.sql.ResultSet; public class DatabaseSupportedType { private static final String URL = "jdbc:mysql://localhost/kodejava"; private static final String USERNAME = "kodejava"; private static final String PASSWORD = "s3cr*t"; public static void main(String[] args) { try (Connection connection = DriverManager.getConnection...
JDBC / NOTES</>↗JDBC18 Feb 2008
A database transaction in any relational database management system (RDBMS) is a sequence of one or more SQL operations that are executed as a single unit of work. The primary characteristics and properties of transactions are encapsulated in the ACID principles: Atomicity: Ensures that all operations within the transaction are completed successfully. If any operation […]
JDBC / NOTES</>↗JDBC15 Feb 2008
The code below helps you to get some product information about the database that you use in creating your program. You can retrieve database information such as the major and minor version of the product, the database product name and its release version. package org.kodejava.jdbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.DatabaseMetaData; import java.sql.SQLException; public class […]