Connecting JDeveloper to Oracle Database

Posted on October 18th, 2008 At 12:44 am by baldo

In this post I’ll show how to connect Oracle Developer 10.1.3 to an Oracle 10g XE human resources sample schema.

Prerequisites

JDeveloper.

Oracle database.

Oracle database schemas. By default Human Resources(hr) schema is installed in Oracle 10g XE. If you want to install more sample schemas refer to the documentation.

Connection

Start Oracle Database Server and unlock Human Resources(hr) user.
 
# /etc/init.d/oracle-xe start
Starting Oracle Net Listener.
Starting Oracle Database 10g Express Edition Instance.
    
If you are using HR sample schema for the first time you must unlock, grant CONNECT and RESOURCE roles and set a password to it. You can do this by using Oracle Enterprise Manager or through SQL * Plus commands.

Open your SQL * Plus terminal and type:

 
SQL * Plus
SQL * Plus: Release 10.2.0.1.0 – Production on Fri Oct 17 21:44:04 2008

Copyright© 1982, 2005, Oracle. All rights reserved.
SQL> conn sys/my_secret_pass@XE as SYSDBA Connected. SQL> ALTER USER hr IDENTIFIED BY hr ACCOUNT UNLOCK;
User altered.
SQL> GRANT CONNECT, RESOURCE to hr;
Grant succeeded.
SQL> ALTER USER hr IDENTIFIED BY my_secret_pass;
User altered.
SQL> quit

Start JDeveloper and launch connection wizard.

 
$ cd jdeveloper/jdev/bin/
$ ./jdev

Oracle JDeveloper 10g 10.1.3.3 Copyright 1997, 2007 Oracle. All Rights Reserved

Once started go to connection navigator, right click on Database and select New Database Connection… to launch the Connection Wizard.

  • Database Connection wizard – Step 1

    Specify a connection name and leave Oracle (JDBC) as connection type.

  • Database Connection wizard – Step 2

    Specify user name and password for your HR schema and check Deploy Password box.

  • Database Connection wizard – Step 3

    Specify connection information for the database machine. In my case the database server is hosted in the same machine I have JDeveloper installed. Type XE as System Identifier(SID).

  • Database Connection wizard – Step 4

    Test connection, if got success, Поздравляю!, if not, try again.

Category: Oracle


Oracle Database 10g XE Installation

Posted on October 11th, 2008 At 11:45 pm by baldo

To perform this installation download the package form oracle website according to your OS, Linux Distribution or System Architecture..

http://www.oracle.com/technology/software/products/database/index.html

Installation on Debian Lenny. As root run the following commands:

 
# dpkg -i oracle-xe_10.2.0.1-1.0_i386.deb
Selecting previously deselected package oracle-xe.
(Reading database … 130936 files and directories currently installed.)
Unpacking oracle-xe (from oracle-xe_10.2.0.1-1.0_i386.deb) ...
dpkg: dependency problems prevent configuration of oracle-xe:
oracle-xe depends on libaio (>= 0.3.96)  libaio1 (>= 0.3.96); however:
Package libaio is not installed.
Package libaio1 is not installed.
dpkg: error processing oracle-xe (—install):
dependency problems – leaving unconfigured
Processing triggers for man-db …
Errors were encountered while processing:
oracle-xe*
    

Install Linux kernel AIO access library development files.

 
# aptitude install libaio-dev
# dpkg -i oracle-xe_10.2.0.1-1.0_i386.deb
Selecting previously deselected package oracle-xe.
(Reading database … 130991 files and directories currently installed.)
Unpacking oracle-xe (from oracle-xe_10.2.0.1-1.0_i386.deb) ...
Setting up oracle-xe (10.2.0.1-1.0) ...
update-rc.d: warning: /etc/init.d/oracle-xe missing LSB information
update-rc.d: see http://wiki.debian.org/LSBInitScripts

Executing Post-install steps… You must run ’/etc/init.d/oracle-xe configure’ \ as the root user to configure the database.
Processing triggers for man-db …

Configuration.

 
# /etc/init.d/oracle-xe configure

Oracle Database 10g Express Edition Configuration
This will configure on-boot properties of Oracle Database 10g Express Edition. The following questions will determine whether the database should be starting upon system boot, the ports it will use, and the passwords that will be used for database accounts. Press <Enter> to accept the defaults. Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application Express [8080]:
Specify a port that will be used for the database listener [1521]:
Specify a password to be used for database accounts. Note that the same password will be used for SYS and SYSTEM. Oracle recommends the use of different passwords for each database account. This can be done after initial configuration: Confirm the password:
Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:n
Starting Oracle Net Listener…Done Configuring Database…
Starting Oracle Database 10g Express Edition Instance…Done Installation Completed Successfully. To access the Database Home Page go to “http://127.0.0.1:8080/apex”

To start, stop and restart the Database Server from command line. As root type:

 
# /etc/init.d/oracle-xe start
Starting Oracle Net Listener.
Starting Oracle Database 10g Express Edition Instance.

# /etc/init.d/oracle-xe stop Shutting down Oracle Database 10g Express Edition Instance. Stopping Oracle Net Listener.
# /etc/init.d/oracle-xe restart Shutting down Oracle Database 10g Express Edition Instance. Stopping Oracle Net Listener.
Starting Oracle Net Listener. Starting Oracle Database 10g Express Edition Instance.

Note: This installation is only for testing purposes.

Category: Oracle


Error Initializing OC4J

Posted on October 10th, 2008 At 3:00 pm by baldo
 
$ ./start_oc4j
08/10/10 13:15:34 Error initializing server: At least one valid code-source 
or import-shared-library element is required for shared-library 
“oracle.expression-evaluator” in 
/home/baldo/dev_tools/jdeveloper/j2ee/home/config/server.xml.
08/10/10 13:15:34 Fatal error: server exiting
    

This is my oracle.home in server.xml.

/home/baldo/dev_tools/java/jdevstudiobase10133/

And this is my current oracle.home.

/home/baldo/dev_tools/jdeveloper/

ERROR: DO NOT CHANGE ORACLE HOME AFTER SETUP SERVER CONFIGURATION.

To solve this problem replace your current server.xml to server.xml provided by oracle jdeveloper package. Or edit your current server.xml to add the new oracle.home.

 
$ mv /home/baldo/dev_tools/jdevstudiobase10133/j2ee/home/config/server.xml \
/home/baldo/dev_tools/jdeveloper/j2ee/home/config/
$ ./start_oc4j
08/10/10 14:01:55 Oracle Containers for J2EE 10g (10.1.3.3.0)  initialized
		
    

Category: Oracle


Simple steps to get JDeveloper running on Linux

Posted on October 4th, 2008 At 3:30 am by baldo

1.- Download this wonderful feature form the official web page and unzip the file, there is not necessary to perform an installation.

http://www.oracle.com/technology/products/jdev/index.html

Note: “jdevstudio” includes the Windows version of JDK 5.0 Update 6 and the JDeveloper documentation. In my case i already have installed JDK 6.0, so I downloaded “jdevstudiobase” which includes the JDeveloper documentation, but not JDK.

2 .- Set the variable “SetJavaHome” in the file <jdev_home>/jdev/bin/jdev.conf to the location of your Java installation. JavaHome is the location for your JDK directory, in my case /usr/lib/jvm/java-6-sun/.

3 .- Modifying Permissions

All JDeveloper files must have read permissions.

 
$ chmod -R g+r jdeveloper/
    

4 .- Backup and Replace old SDK cursors

 
# mv /usr/lib/jvm/java-6-sun/jre/lib/images/cursors/ \
/usr/lib/jvm/java-6-sun/jre/lib/images/cursors.bak
    
Extract and move the replacement cursors from: your/jdev_home/jdev/bin/clear_cursors.tar
 
$ tar xf clear_cursors.tar
# mv jre/lib/images/cursors/ /usr/lib/jvm/java-6-sun/jre/lib/images/
    

5 .- Starting JDeveloper

 
$ cd jdeveloper/jdev/bin/
$ ./jdev
Oracle JDeveloper 10g 10.1.3.3
Copyright 1997, 2007 Oracle.  All Rights Reserved
    

Пpекpасно !

Category: Oracle, Java