Home Archives for March 2015
Sunday, March 29, 2015
Thursday, March 26, 2015
Monday, March 23, 2015
How to connect DB2 database in java?
We have to follow 6 steps to play with DB2 database in java jdbc.
Note: We have use “db2jcc_license_cu-version.jar” and “db2jcc-version.jar” ex- “db2jcc_license_cu-1.0.jar” and “db2jcc-1.0.jar”
Step 1: Create table in database
CREATE TABLE USER_DETAILS (
USER_ID INTEGER,
USER_NAME VARCHAR(50) NOT NULL,
PASSWORD VARCHAR(50) NOT NULL,
PRIMARY KEY(USER_ID)
)
Note: We have use “db2jcc_license_cu-version.jar” and “db2jcc-version.jar” ex- “db2jcc_license_cu-1.0.jar” and “db2jcc-1.0.jar”
Step 1: Create table in database
CREATE TABLE USER_DETAILS (
USER_ID INTEGER,
USER_NAME VARCHAR(50) NOT NULL,
PASSWORD VARCHAR(50) NOT NULL,
PRIMARY KEY(USER_ID)
)
How to connect Oracle database in java?
We have to follow 6 steps to play with Oracle database in java jdbc.
Note: We have use “ojdbc-version.jar” ex- ojdbc14.jar
Step 1: Create table in database
CREATE TABLE USER_DETAILS (
USER_ID NUMBER(5) NOT NULL,
USER_NAME VARCHAR2(50) NOT NULL,
PASSWORD VARCHAR2(50) NOT NULL,
) ;
How to connect MySql database in java ?
We have to follow 6 steps to play with MySql database in java jdbc.
Note: We have use “mysql-connector-java-version-bin.jar” ex- mysql-connector-java-5.0.3-bin.jar
Step 1: Create table in database
CREATE TABLE ‘USER_DETAILS’ (
‘USER_ID’ INT(5) NOT NULL,
‘USER_NAME’ VARCHAR(50) NOT NULL,
‘PASSWORD’ VARCHAR(50) NOT NULL,
PRIMARY KEY(‘USER_ID’)
) ;
Note: We have use “mysql-connector-java-version-bin.jar” ex- mysql-connector-java-5.0.3-bin.jar
Step 1: Create table in database
CREATE TABLE ‘USER_DETAILS’ (
‘USER_ID’ INT(5) NOT NULL,
‘USER_NAME’ VARCHAR(50) NOT NULL,
‘PASSWORD’ VARCHAR(50) NOT NULL,
PRIMARY KEY(‘USER_ID’)
) ;
How to create Singleton class in java?
Step 1: Create Class “SingleObject.java”
Step 2: Create a private constructor so no one can instantiate this class.
Step 3: Create the static method getInstance and this will return the object of SingleObject class.
Step 4: Create client program and call this static method of SingleObject class this method will return the same object each time.
Step 5: We can verify the the singleton behavior by hashCode. The hasCode is same for both object.
Step 2: Create a private constructor so no one can instantiate this class.
Step 3: Create the static method getInstance and this will return the object of SingleObject class.
Step 4: Create client program and call this static method of SingleObject class this method will return the same object each time.
Step 5: We can verify the the singleton behavior by hashCode. The hasCode is same for both object.
Saturday, March 21, 2015
Subscribe to:
Posts
(
Atom
)