23 August 2010
0 JAVA installation and Set Up
Installation and Set Up of JAVA in Windows and UNIX machines
Before we begin JAVA installation, some points on JAVA installation• For executing Java Programs Java 2 SDK Version 1.4 or higher Version needs to be installed.
• Java 2 SDK Can be downloaded freely from http://java.sun.com
• IDEs for JAVA are Eclipse and Netbeans, and Eclipse can be downloaded freely and doesnot require installation
Setting Environment variables for Java
We need to set some Environmental variables.
• Environmental variable is a variable that describes the operating environment of the process
• Common environment variables describe the home directory, command search path etc.
Environment variables used by JVM
JAVA_HOME
This environment variable is pointing to the Java Installation directory. This environment variable is used to derive all other environment variables used by JVM
set JAVA_HOME=C:\ProgramFiles\JAVA\jdk1.4.3
In UNIX:
export JAVA_HOME=/var/usr/java
CLASSPATH
Path variable is used by OS to locate executable files
set PATH=%PATH%;%JAVA_HOME%\lib\tools.jar
In UNIX:
set PATH=$PATH:$JAVA_HOME/lib/tools.jar:.
Do the Environmental variable settings by typing the given commands in the Command Prompt and Type ‘javac’. It will display all the options of using javac as shown in the diagram. If it says bad command or file name then check the path setting.
Alternate way to set CLASSPATH
set PATH=%PATH%;%JAVA_HOME%\bin
In UNIX:
set PATH=$PATH:$JAVA_HOME/bin
0 How to set Environment variables for Java
How to set Environment variables for Java?
• Environmental variable is a variable that describes the operating environment of the process
• Common environment variables describe the home directory, command search path etc.
Environment variables used by JVM
JAVA_HOME
This environment variable is pointing to the Java Installation directory. This environment variable is used to derive all other environment variables used by JVM
set JAVA_HOME=C:\ProgramFiles\JAVA\jdk1.4.3
In UNIX:
export JAVA_HOME=/var/usr/java
CLASSPATH
Path variable is used by OS to locate executable files
set PATH=%PATH%;%JAVA_HOME%\lib\tools.jar
In UNIX:
set PATH=$PATH:$JAVA_HOME/lib/tools.jar:.
Do the Environmental variable settings by typing the given commands in the Command Prompt and Type ‘javac’. It will display all the options of using javac as shown in the diagram. If it says bad command or file name then check the path setting.
Alternate way to set CLASSPATH
set PATH=%PATH%;%JAVA_HOME%\bin
In UNIX:
set PATH=$PATH:$JAVA_HOME/bin
0 How to get data from session Java
How to Extract data from session in Java?
Get the session
Extract data from session
• If you cast to a generic type, use @SuppressWarnings
0 Challenges in Session Tracking Java
support for distributed Web applications
Load balancing used to send different requests to different machines. Sessions should still work even if different hosts are hit.support for persistent sessions
Session data written to disk and reloaded when server is restarted(as long as browser stays open).• Tomcat 5 supports this
22 August 2010
0 CRUD operations in MySQL Database
CRUD operations
CRUD is the acronym for Create, Read, Update and Delete. Create, Read, Update and Delete (CRUD) are the 4 basic functions of a Database or persistent storage. CRUD refers to all of the major functions that need to be implemented in a RDBMS.Each letter in the CRUD can be mapped to a standard SQL statement:
Read SELECT
Update UPDATE
Delete DELETE
CRUD operations in MySQL Database
Insert Data Into MySQL Database Table
The INSERT INTO statement is used to add new records to a database table.
Syntax
It is possible to write the INSERT INTO statement in two forms.
The first form doesn't specify the column names where the data will be inserted, only their values:
VALUES (value1, value2, value3,...)
The second form specifies both the column names and the values to be inserted:
VALUES (value1, value2, value3,...)
Select Data From MySQL Database Table
The SELECT statement is used to select data from a database.
Syntax
FROM table_name
Update Data In MySQL Database Table
The UPDATE statement is used to update existing records in a table.
Syntax
SET column1=value, column2=value2,...
WHERE some_column=some_value
Delete Data from MySQL Database Table
The DELETE FROM statement is used to delete records from a database table.
Syntax
WHERE some_column = some_value