JDBC / CATATAN</>↗JDBC07 Jan 2008
package org.kodejava.jdbc; import java.io.File; import java.io.FileWriter; import java.io.Reader; import java.nio.charset.StandardCharsets; import java.sql.*; public class ClobReadDemo { 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 conn = DriverManager.getConnection(URL, USERNAME, PASSWORD)) { Stri...
JDBC / CATATAN</>↗JDBC02 Jan 2008
package org.kodejava.jdbc; import java.io.File; import java.io.FileReader; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.SQLException; public class ClobInsertDemo { 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 conn = DriverManager.getC...
JDBC / CATATAN</>↗JDBC30 Des 2007
This example shows you how to read BLOBs data from database table. package org.kodejava.jdbc; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.sql.*; public class BlobReadDemo { 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) { […]
JDBC / CATATAN</>↗JDBC26 Des 2007
Database BLOBs (Binary Large Objects) can be used to store any data, such as images, audio, or video files, for instance. This example shows you how we use JDBC library to store image in our database. To send the binary information to the database, we can call the PreparedStatement.setBinaryStream() method and pass the appropriate input […]
JDBC / CATATAN</>↗JDBC25 Des 2007
Stored-procedure are user-generated functions or procedures that, once created in the database, it can be called by the client applications, such as Java application. In this example we’ll demonstrate how to use the JDBC java.sql.CallableStatement to call a stored procedure. The store procedure in this example is just for selecting records from the products table. […]
CORE API / CATATAN</>↗Core API21 Des 2007
The trick to sort a java.util.Set is to use the implementation of a java.util.SortedSet such as the java.util.TreeSet class. The example below shows you the result of using the java.util.TreeSet class, in which the items in it will be sorted based on the element’s natural order. package org.kodejava.util; import java.util.Set; import java.util.TreeSet; public class TreeSetDemo […]