Illustrating use of BFiles
This Sample illustrates accessing
of BFiles using JDBC. The sample uses the JDBC-Thin driver; the code is
the same for JDBC-OCI, Steps in the Sample
|
Required Software |
Installation and Configuration |
The section has step-by-step instructions to run this application successfully. This will be discussed in the following subsections
Run the sample using Oracle9i JDeveloper
Run the sample using the JDK environment
Step 1. Unjar BFileSample.jar using Winzip, or using the following command:
> jar xvf BFileSample.jar
You will find jar.exe in JDK_HOME\bin. Ensure that JDK_HOME\bin is in your system path. (JDK_HOME is the root directory of the JDKx.x installation ).
This creates a folder BFileSample with all the source files
Step 2. Go to BFileSample Directory. You will find the image file 'architect.gif'. You need to ftp/copy this .gif file on to the Server where Database is mounted. Please note the complete path of the directory where you have copied this image file. This is the directory that you will specify when the application prompts for the full path to the image on the database server.
Step 3. Edit Connection.properties file located in the directory BFileSample\src. Change the following attributes to those of the database instance you want to connect to.
Change the following lines:
HostName = insn104a.idc.oracle.com SID = otn9i Port = 1521 UserName = scott Password = tiger
Ensure that the database user you are using for this samples has CREATE ANY DIRECTORY system privileges.
This can be done by running the following command at the SQL prompt after connecting as system/<password>
SQL> GRANT CREATE ANY DIRECTORY TO <database-username>;
Step 1. Using JDeveloper File/Open option select the BFileSample.jws from the BFileSample directory.
Step 2. Select Project/Make from JDeveloper main menu and select Make Project "BFileSample.jpr"
Step 3. Select Run/Run BFileSample.jpr from JDeveloper main menu to run the application.
Step 1. Install
Oracle JDBC Driver and include the zip/jar files in the CLASSPATH
Alos
ensure that BFileSample\src directory is added to the CLASSPATH
Step 2. Change directory to BFileSample\src\oracle\otnsamples\jdbc\bfile.
Compile the files using javac:
%javac *.java
Step 3. Run the class file using java from BFileSample
directory:
%java
oracle.otnsamples.jdbc.bfile.BFileSample
Description of Sample Files |
BFileSample is the top level directory.
|
Directory
|
Files
|
Description
|
| BFileSample | Readme.html | This file |
| BFileSample.jws | The Oracle9i JDeveloper workspace file | |
| BFileSample.jpr | The Oracle9i JDeveloper project file | |
| architect.gif | Image file which is stored as BFILE Column | |
| BFileSample\src | Connection.properties | This file has the details of the database connection parameters |
| BFileSample\src\oracle\otnsamples\jdbc\bfile | BFileSample.java | The source file for sample |
| BFileFrame.java | The source file for the sample User Interface |