JDBC / NOTES</>↗JDBC03 Feb 2007
package org.kodejava.jdbc; import java.sql.*; public class GetGeneratedKeyExample { 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)) { // The orders table have an ID column which value will be […]
JDBC / NOTES</>↗JDBC02 Feb 2007
Executing a database manipulation command such as insert, update or delete can sometime throw exception due to invalid data. To protect the integrity of our application data we must make sure that when a transaction fails we must rollback all the executed queries. In this example we are using MySQL database. To enable transaction capability […]
SERVLET / NOTES</>↗Servlet31 Jan 2007
A cookie is a piece of information sent to a browser by a Web Server. The browser then returns that information to the Web server. This is how some Web pages remember your previous visits; for example, an e-commerce website might use a cookie to remember which items you’ve placed in your online shopping cart. […]
JDBC / NOTES</>↗JDBC27 Jan 2007
The following example show you how to create a connection to Microsoft Access databases. To allow the database access to be authenticated, the security user account can be added from File -> Info -> Users and Permissions screen. Just like accessing any other databases in the Java platform we need a JDBC driver. To access […]
CORE API / NOTES</>↗Core API23 Jan 2007
This example shows us how to use the System.nanoTime() method to get the amount of time a process take place. Please be aware that the nano time value is not related to the real world time value. package org.kodejava.lang; public class ElapsedTimeExample { public static void main(String[] args) { // Get the start time of […]
APPLET / NOTES</>↗Applet20 Jan 2007
The code below demonstrate the very basic of Java applet. Applet is a small Java application that can be embedded on the web browser. package org.kodejava.applet; import java.applet.*; import java.awt.*; public class HelloWorldApplet extends Applet { public void init() { } public void start() { } public void stop() { } public void destroy() { […]