Javascript  
 
  ScriptJava  
 
  Perl  
 
  PHP  
 
  ROR  
 
  ask us  
 

 

Applications
  1. Getting started
  2. Definitions
  3. First program
  4. Characters and Strings
  5. Object and methods
  6. Arrays and Circles
  7. Exceptions
  8. The main method
  9. Reading
  10. Writing file
  11. Vectors
  12. Stacks
  13. Map The Dictionary
  14. Lists
  15. Linked lists
  16. Collection
  17. Interfaces
  18. Scanner
  19. StringTokenizer
  20. Generics
  21. JDBC
  22. DataBase Queries
  23. JSP, The main step

Graphics

Applets
  1. Regards
  2. One Picture
  3. Calculator
  4. Random pictures
  5. Bouncing picture

Swings
  1. Buttons listeners
  2. TextFields
  3. Swing Example

JavaBeans
  1. The first step
  2. Example

Search a word:
   



© The scientific sentence. 2010

HowTo: JDK1.5, JDK1.6, Apache2.2, Tomcat6.0, and Oracle 10g
Java, Apache, Tomcat,
Oracle Database: How to
  


IV. Installing Oracle:

IV.1. Installation:

Download Oracle Database 10g Express Edition, DO NOT INSTALL yet, just download at
Go to: 
http://www.oracle.com/technology/software/products/database/xe/index.html
Click on the “Oracle Database 10g Express Edition for Microsoft Windows” link
Click on the “OracleXE.exe” download link
The file to download is: “OracleXE.exe” (165,332,312 bytes)
Once downloaded, doubleclick on the “OracleXE.exe” to start the installation.

The installation is done on: C:\oraclexe
Set the oracle_home:
Sittings - Control Panel - System - Advanced - Environment Variables, and then:
ORACLE_HOME C:\oraclexe\app\oracle\product\10.2.0\server

Now, the CLASSPATH setting is as follows:
.;C:\Program Files\Java\jre1.6.0_01\lib\ext\QTJava.zip;
C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar


Oracle will appear in localhost:8080
(if you set yes during the installation). To transfere it at localhost:15:
1. Run SQL Command Line from:
start - programs - Oracle database 10g Express Edition
2. Connect to Oracle Database:
SQL> connect
Enter user-name: System
Enter password: ******
Connected.
3. We have :
 select dbms_xdb.gethttpport as "HTTP-Port", dbms_xdb.getftpport 
 as "FTP-Port" from dual;

 HTTP-Port   	  FTP-Port
 ----------             ----------
      8080            0

4. Change http and ftp ports as follows:
SQL> -- set http port and ftp port
SQL>  begin
  2  dbms_xdb.sethttpport ('1521');
  3  dbms_xdb.setftpport ('1520');
  4  end;
  5  /

PL/SQL procedure successfully completed.

5. Check if everything is ok:
SQL> select dbms_xdb.gethttpport as "HTTP-Port", dbms_xdb.getftpport 
as "FTP-Port" from dual;

 HTTP-Port     FTP-Port
  ----------          ----------
      1521         1520

SQL> quit

From now on Oracle Database runs on http://localhost:1521/


IV.2. Set the oracle jdbc package:

Next, to connect to Oracle Database, we need the 
JDBC(Java DataBase Connctivity); that is is an application programming 
interface (API) to access SQL data.
Go to:
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/
htdocs/jdbc_10201.html
and dowload  ojdbc6 or ojdbc6_g and put it in the installation 
directory like: 
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib
Set the class_pah:
CLASSPATH C:/oraclexe/app/oracle/product/10.2.0/server/
jdbc/lib/ojdbc6.jar

Finaly, the CLASSPATH setting is as follows:
CLASSPATH: .;C:\Program Files\Java\jre1.6.0_01\lib\ext\QTJava.zip;
C:\Program Files\Apache Software Foundation\Tomcat 6.0\
lib\servlet-api.jar;
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc6.jar




IV.3. Test the connectivity:

IV.3.1. Preface:
JDK1.6, Oracle 10g 2(10.2.0.1.0), and jdbc6 do not work, because 
the installled oracle version do not mach (JDK, and jdbc5 or jdbc6). 
Down grade in this case.

The version of Oracle installed is: Oracle Databse 10g Release 
2(10.2.0.1.0). For this release, there is not a driver jdbc related 
to JDK1.6, but there is one corresponding 
to ojdbc14.jar related to JDK1.5. Foretheremore:
Oracle 10g 2(10.2.0.1.0), JDK1.5, and ojdbc14.jar work fine. 
From now on, to connect to Oracle database. JDK1.5 is used.

The related classpath is then:
CLASSPATH =.;C:\Program Files\Java\jre1.5.0_14\lib\ext\dnsns.jar;
C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar;
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;
C:\oraclexe\app\oracle\product\10.2.0\server\jlib\orai18n.jar

IV.3.2. Examples:
a. First application: Get connection:

import java.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.OracleDriver;

  public class OracleConnect
  {
    public static void main(String[] args)throws SQLException
    {
      try
      {
        Class.forName("oracle.jdbc.driver.OracleDriver");	
        Connection conn = DriverManager.getConnection("jdbc:oracle:thin:
		@HOST:1521:XE","User","Password");
		if(conn != null)
		{ System.out.println("I am Connected to oracle database");
			}
        conn.close();
      } catch (Exception e) {
        System.out.println("ERROR : " + e);
        e.printStackTrace(System.out);
      }
    }
  }

b. Second application: Test connection, question a built 
Students database:

import java.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.OracleDriver;	
	
public class showTable{
  public static void main (String args []) throws SQLException
  {
     DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
        Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@HOST:1521:XE",
		"User","Password");		
		Statement stmt = conn.createStatement();
	try {
    ResultSet rs = stmt.executeQuery( "SELECT * FROM Students 
	WHERE STUDENTID ='103' " );
    try {
        while ( rs.next() ) {
            int numColumns = rs.getMetaData().getColumnCount();
            for ( int i = 1 ; i <= numColumns ; i++ ) {//Column numbers start at 1.
               System.out.println( "COLUMN " + i + " = " + rs.getObject(i) );
            }
		System.out.println();
        }
    } finally {
        rs.close();
    }
} finally {
    stmt.close();
	}
  }
}// End of class


Apache Tomcat

  
Google
Web
ScientificSentence
 




chimie labs
|
scientific sentence
|
java
|
php
|
green cat
|
contact
|


© Scientificsentence 2009. All rights reserved.