Connecting to Sybase SQL Anywhere Database in Java

Sybase SQL Anywhere is a powerful database server suitable for enterprise applications. It is also a common database backend for Java Web applications. This article provides a step by step tutorial on connecting and querying data from a Sybase SQL Anywhere database using Java. We will also look at a sample Java class which returns […]

Finding Perfect Numbers in a Range Using Java

A perfect number is a positive integer that is equal to the sum of its proper divisors excluding itself. For example, 6 is a perfect number since the sum of its divisors (1 + 2 + 3) is equal to 6. Finding Perfect Numbers in a Range Using Java The following Java program finds all […]

Checking Whether a Number is a Perfect Square Number in Java

A number is known as a square number or perfect square if the number is a square of another number. That is an number n is square if it can be expressed as n = a * a where a is an integer. Some examples of perfect numbers (square numbers) are , 9 = 3 […]

Find Smallest Number in an Array Using Java

The following Java program prints the smallest number in a given array. This example uses an inline array, however it can be easily changed to a method taking an array as parameter. We loop through the array comparing whether the current smallest number is bigger than the array value. If yes, we replace the current […]

Connecting to Oracle Database in Java

This article is a step by step guide on connecting to an Oracle database from a Java program. The following standalone program demonstrates Oracle database connectivity using JDBC API. In this program we will use the Oracle’s built dummy table DUAL to retrieve Oracle’s system date. Java provides a standard interface to connect to databases […]