Skip Headers
Oracle® Multimedia DICOM Developer's Guide
11g Release 1 (11.1)

Part Number B28416-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

7 DICOM Application Development

This chapter describes how to develop applications using Oracle Multimedia DICOM. Using either the ORDDicom object type interface, the relational interface, or the DICOM Java interface Oracle Multimedia DICOM provides support for Oracle Database so you can quickly develop applications to upload to the database, retrieve from it, and manipulate DICOM content.

This chapter includes examples of how to import DICOM content into the database, write SQL queries based on DICOM metadata, perform basic image processing, make anonymous copies of ORDDicom objects, and check DICOM content for conformance to user-defined constraint rules.

This chapter includes the following sections:

Oracle Multimedia provides more features than those that are described in this chapter. For additional information, see the following documents in the Oracle Multimedia software documentation set:

For additional examples, articles, and other information about Oracle Multimedia, see the Oracle Multimedia Software section of the Oracle Technology Network Web site at

http://www.oracle.com/technology/products/multimedia/

7.1 Setting Up Your Environment

The examples in this chapter use the table medical_image_table with these four columns:

For a user scott to use these examples, the following statements must be issued before scott executes the examples, where /mydir/work is the directory where scott will find the DICOM files:

CONNECT /as sysdba
CREATE OR REPLACE DIRECTORY FILE_DIR as '/mydir/work';
GRANT READ ON DIRECTORY FILE_DIR TO 'scott';

Note:

All Oracle Multimedia objects and procedures provided by Oracle are defined in the schema ORDSYS.

7.2 Creating a Table with an ORDDicom Column

This section shows how to create a table with an ORDDicom column to store DICOM content.

The code snippet shown in Example 7-1 creates the table medical_image_table, with the four columns id, dicom, imageThumb, and anonDicom.

Example 7-1 Create a Table for DICOM Content

CONNECT scott/tiger

create table medical_image_table
             (id          integer primary key,
              dicom       ordsys.orddicom,
              imageThumb  ordsys.ordimage,
              anonDicom   ordsys.orddicom)
--
-- Use SecureFile LOBS for media content
--
lob(dicom.source.localData)      store as SecureFile,
lob(imageThumb.source.localData) store as SecureFile,
lob(anonDicom.source.localData)  store as SecureFile;

Example 7-1 uses SecureFile LOB storage for the media content. Oracle SecureFiles is a re-engineered binary large object (BLOB) that improves performance and strengthens the content management capabilities of Oracle Database. See Oracle Database SecureFiles and Large Objects Developer's Guide for more information about SecureFile LOBs. See Oracle Multimedia User's Guide for tuning tips with SecureFile LOBs.

7.3 Loading DICOM Content Using the SQL*Loader Utility

This section shows how to use the SQL*Loader utility to load DICOM content into an existing table in Oracle Database. SQL*Loader is a high-performance utility for loading data from external files into tables in an Oracle database. The external data can be loaded across a network from a client machine that differs from the machine that is running the server for Oracle Database. The data can also be loaded locally on the same machine as the database server. For more information on SQL*Loader, see Oracle Database Utilities.

A typical SQL*Loader session accepts a control file and one or more data files as input. The control file defines how the data will be loaded into the database. The output of the SQL*Loader session is an Oracle database (where the data is loaded), a log file, and potentially, a discard file.

Example 7-2 shows a control file for loading DICOM data into the table medical_image_table, which you created in Section 7.2. The control file contains directives that map the input data, which is specified at the end of the control file as sample1.dcm and sample2.dcm, to the columns of the table medical_image_table. Only the id and dicom columns are loaded with externally supplied data. The imageThumb and anonDicom columns are initialized using constant and default values that are supplied in the control file.

Example 7-2 Loading DICOM Content

-- This file is a SQL*LDR control file to load DICOM data
-- into the table MEDICAL_IMAGE_TABLE. The control file contains directives
-- to load DICOM data into the DICOM column. It also contains directives
-- to initialize the IMAGETHUMB and ANONDICOM columns. The data to be loaded
-- is specified in this file after the BEGINDATA delimiter.
--
--  The following command invokes the SQL*Loader utility.
--
--    sqlldr userid=USER/PASSWORD  control=load_dicom.ctl
--
--
load data
-- 
-- The input data is contained in this file after the BEGINDATA delimiter.
--
infile *
into table medical_image_table
--
-- This example truncates the table. Change the following to "append"
-- if you want to add to an existing table.
--
truncate
fields terminated by whitespace optionally enclosed by '"'
(
 --
 -- The primary key column.
 --
 id                 integer external,
 --
 -- A filler field that holds the file path of the DICOM data.
 --
 dicomFilename      filler char,
 --
 -- Load the dicom column object
 --    The LOB attribute source.localData is loaded with the DICOM data.
 --    The srcType attribute is initialized to "local".
 --    The updateTime attribute is initialized to "SYSDATE".
 --    The LOB attribute extension is initalized with an empty LOB.
 --
   dicom             column object (
     source          column object (
       localData     lobfile(dicomFilename) terminated by EOF,
       srcType       constant 'local',
       updateTime    expression "SYSDATE"
     ), 
     extension       lobfile(dicomFilename) terminated by EOF
                      defaultif dicom.source.srcType='local'
   ),
 --
 -- Initialize the imageThumb column object
 --    The LOB attribute source.localData is initialized with an empty LOB.
 --    This LOB will hold the content for the thumbnail image.
 --    The local attribute is initialized to "1".
 --
   imageThumb        column object (
     source          column object (
       localData     lobfile(dicomFilename) terminated by EOF
                       defaultif imageThumb.source.local=X'1',
       local         constant 1
     )
   ),
 --
 -- Initialize the anonDicom column object
 --    The LOB attributes source.localData and extension are initialized.
 --      with empty LOBs. 
 --    The localData LOB will hold the content for the DICOM data to be
 --      made anonymous.
 --    The extension LOB is an internal field used by ORDDICOM.
 --    The srcType attribute is initialized to "local".
 --
   anonDicom         column object (
     source          column object (
       localData     lobfile(dicomFilename) terminated by EOF
                       defaultif anonDicom.source.srcType='local',
       srcType       constant 'local'
     ), 
     extension         lobfile(dicomFilename) terminated by EOF
                      defaultif dicom.source.srcType='local'
   )
)
--
-- Input data begins here
--
-- ID  DICOMFILENAME
BEGINDATA
   1   sample1.dcm
   2   sample2.dcm

Before invoking the SQL*Loader utility, you can temporarily disable logging for the LOB data to be loaded into the dicom column. When logging is disabled, the data is written to the database table only, and not to the redo log. Disabling logging can reduce the amount of time needed to load the DICOM data by cutting in half the amount of I/O to be performed. For more information about LOBs and logging, see Oracle Database SecureFiles and Large Objects Developer's Guide.

To disable logging for the DICOM content in the dicom column, use the following SQL command:

alter table medical_image_table modify lob(dicom.source.localData) (nocache nologging);

To invoke the SQL*Loader utility, use the following command:

sqlldr userid=USER/PASSWORD  control=load_dicom.ctl

After the DICOM data is loaded, use the following SQL command to re-enable logging for the DICOM content in the dicom column:

alter table medical_image_table modify lob(dicom.source.localData)  (nocache logging);

After the DICOM data is loaded into the table from the external files, another program is required to complete the initialization of the dicom column and to generate the data to populate the imageThumb and anonDicom columns. These tasks can be performed using methods of the ORDDicom object, as shown in Example 7-3. In this example, the dicom column is initialized using the setProperties( ) method. The imageThumb column object is created using the processCopy( ) method. And, the anonDicom column object is created using the makeAnonymous( ) method, which requires a unique identifier for one of its input arguments.

Example 7-3 defines a function genUID( ) to generate a unique identifier (UID) by concatenating the value of the id column with a DICOM UID root value that you must define. You can replace this function with another function that generates unique UIDs, in accordance with the standards for your organization.

Example 7-3 Finish Loading and Initializing the DICOM Table

--
-- The ORDDicom method makeAnonymous() takes a unique UID as an input parameter.
-- This utility function generates a simple UID to use in this example.
-- Replace the string value of UID_ROOT with the DICOM UID for your organization.
--
create or replace function genUID(in_id varchar2)
return varchar2
is
 -- Declare the DICOM UID root value for your organization
 -- You must replace this value.
 UID_ROOT varchar2(128) := '<unique-UID root>';
begin
 return UID_ROOT || '.' || in_id;
end;
/
show errors;
 

--
-- This PL/SQL block loops over all the rows in the MEDICAL_IMAGE_TABLE and:
-- 1. Calls the ORDDicom method setProperties() to initialize the dicom column
-- 2. Calls the ORDDicom method processCopy() to create a JPEG thumbnail image
--    that is stored in the imageThumb column.
-- 3. Calls the ORDDicom method makeAnonymous() to create an anonymous version
--    of the dicom column. The new version is stored in the column anonDicom.
--
declare
 dcm ordsys.orddicom;
begin
  -- load the DICOM data model
  ord_dicom.setDatamodel;
 
  -- loop over all rows in the medical image table
  for rec in (select * from medical_image_table for update) loop
 
    -- initialize the dicom column
    rec.dicom.setProperties();
 
    -- create a JPEG thumbnail 
    rec.dicom.processCopy('fileFormat=jpeg fixedScale=75,100', rec.imageThumb);
 
    -- make a new  anonymous version of the ORDDicom object
    rec.dicom.makeAnonymous(genUID(rec.id), rec.anonDicom);
    -- write the objects back to the row
    update medical_image_table
    set dicom = rec.dicom,
        imageThumb = rec.imageThumb,
        anonDicom = rec.anonDicom
    where id = rec.id;
 
  end loop;
  commit;
end;
/

Example 7-3 loops once over all the rows in the table medical_image_table. Then, it reads and accesses each dicom image in three passes. The first pass sets the properties of the dicom column. The second pass creates a JPEG thumbnail image. And, the third pass creates an anonymous DICOM image to store in the anonDicom column. Because of these repeated read operations, you may want to alter the LOB storage property of the dicom column to enable caching of the DICOM content. For more information about LOBs and logging, see Oracle Database SecureFiles and Large Objects Developer's Guide.

To enable caching for the DICOM content in the dicom column, use the following SQL command:

alter table medical_image_table  modify lob(dicom.source.localData) (cache);

After the initialization is complete, use the following SQL command to disable caching for the DICOM content in the dicom column:

alter table medical_image_table  modify lob(dicom.source.localData) (nocache logging);

See Oracle Database Utilities for more information about using the SQL*Loader utility to load objects and LOBs into Oracle Database.

7.4 Developing DICOM Applications Using the PL/SQL API

This section shows basic PL/SQL code examples that store and manipulate DICOM content inside a database using Oracle Multimedia DICOM.

Oracle Multimedia DICOM allows you to store DICOM content in database tables with columns of type ORDDicom. Table 7-1 shows some of the attributes that are contained within an ORDDicom object in a database table.

Table 7-1 Sample Contents of an ORDDicom Object in a Database Table

ORDDicom

SOP_INSTANCE_UID

SOP_CLASS_UID

STUDY_INSTANCE_UID

SERIES_INSTANCE_UID

Source (ORDDataSource)

Metadata (SYS.XMLType)

ContentLength (integer)

Internal attributes


7.4.1 Selecting DICOM Attributes

This section shows how to access DICOM attributes from the DICOM content you loaded in Section 7.3.

After the table medical_image_table is populated and metadata has been extracted, you can access metadata using SQL queries. Example 7-4 demonstrates how to select extracted DICOM metadata from the DICOM content. The code statements where these operations are performed are highlighted in bold.

Example 7-4 Selected Metadata from the DICOM Content

1.     SOP_INSTANCE_UID.
2.     SOP_CLASS_UID
3.     STUDY_INSTANCE_UID
4.     SERIES_INSTANCE_UID.
5.     Content length (number of bytes of DICOM content)
6.     Patient Name, Patient ID, and Modality from DICOM metadata
 
 
 
 
 
select id,
       t.dicom.getSOPInstanceUID() as SOP_Instance_UID
from medical_image_table t;
 
select id,
       t.dicom.getSOPClassUID() as SOP_Class_UID
from medical_image_table t;
 
select id,
       t.dicom.getStudyInstanceUID() as Study_Instance_UID
from medical_image_table t;
 
select id,
       t.dicom.getSeriesInstanceUID() as Series_Instance_UID
from medical_image_table t;
 
select id,
       t.dicom.getcontentlength() as content_Length
from medical_image_table t;

select id,
        extractValue(t.dicom.metadata,
        '/DICOM_OBJECT/*[@name="Patient''s Name"]/VALUE',
        'xmlns=http://xmlns.oracle.com/ord/dicom/metadata_1_0') as "PATIENT_NAME",
        extractValue(t.dicom.metadata,
        '/DICOM_OBJECT/*[@name="Patient ID"]',
        'xmlns=http://xmlns.oracle.com/ord/dicom/metadata_1_0') as "PATIENT_ID",
        extractValue(t.dicom.metadata,
        '/DICOM_OBJECT/*[@name="Modality"]',
        'xmlns=http://xmlns.oracle.com/ord/dicom/metadata_1_0') as "MODALITY"
from medical_image_table t;

Running Example 7-4 generates the following output:

ID SOP_INSTANCE_UID
-- -------------------------------------------------------
 1 1.2.392.200036.9116.2.2.2.1762676206.1077529882.102147
 
ID SOP_CLASS_UID
-- -------------------------------------------------------
 1 1.2.840.10008.5.1.4.1.1.2
 
ID STUDY_INSTANCE_UID
-- -------------------------------------------------------
 1 1.2.392.200036.9116.2.2.2.1762929498.1080638122.365416
 
ID SERIES_INSTANCE_UID
-- -------------------------------------------------------
 1 1.2.392.200036.9116.2.2.2.1762929498.1080638122.503288
 
ID CONTENT_LENGTH
-- ---------------
 1   525974
 
ID PATIENT_NAME                    PATIENT_ID      MODALITY
--- ------------------------------ ----------      ----------
 1 CANCIO   2HR                    A-02-013        CT 

7.4.2 Creating Thumbnail Images and Changing Image Formats

This section demonstrates some of the image processing operations that can be invoked within the database.

As an example, to create a JPEG thumbnail image from a DICOM image, a new ORDImage object is generated from the ORDDicom object. Before you can complete this task, you must describe the desired properties of the new ORDImage object.

The following description generates a JPEG thumbnail image of size 75x100 pixels:

'fileFormat=jfif fixedScale=75 100'

The code snippet shown in Example 7-5 defines the procedure generate_thumb(), which performs these tasks:

  • Populates the column imageThumb of the table medical_image_table with the identifier source_id.

  • Generates an ORDImage object in the column by invoking the processCopy( ) method on the ORDDicom object in the source row.

The code statements in Example 7-5 where these tasks are performed are highlighted in bold.

Example 7-5 Generate and Process the New ORDImage Object

-- Set Data Model Repository
execute ordsys.ord_dicom.setDataModel();
 
create or replace procedure generate_thumb(source_id number, verb varchar2) is
    dcmSrc    ordsys.orddicom;
    imgDst    ordsys.ordimage;
begin
  select dicom, imageThumb into dcmSrc, imgDst from medical_image_table
         where id = source_id for update;
  dcmSrc.processCopy(verb, imgDst);
 
  update medical_image_table set imageThumb = imgDst where id = source_id;
  commit;
end;
/
 
 
-- Create a JPEG thumbnail image for our test DICOM
execute generate_thumb(1, 'fileFormat=jfif fixedScale=75 100');
 
-- look at our handiwork
column t.imageThumb.getFileFormat() format A20;
select id, t.imageThumb.getWidth(), t.imageThumb.getHeight(), 
       t.imageThumb.getFileFormat() 
from medical_image_table t;

Running Example 7-5 generates the following output:

ID  T.IMAGETHUMB.GETWIDTH() T.IMAGETHUMB.GETHEIGHT() T.IMAGETHUMB.GETFILE
--- ----------------------- ------------------------ ----------------------
 1              75                      100            JFIF

7.4.3 Making Anonymous Copies of ORDDicom Objects

This section shows how to protect patient privacy by making ORDDicom objects anonymous.

To make ORDDicom objects anonymous, you must create a new ORDDicom object in which certain user-specifiable DICOM attributes have either been removed or overwritten in both the new DICOM content and the associated ORDDicom object metadata. An XML anonymity document specifies which DICOM attributes should be removed or replaced and what action should be taken to make each attribute anonymous.

The default anonymity document, ordcman.xml, is loaded during installation. You can create a customized anonymity document, but that topic is beyond the scope of this example. This example uses the default anonymity document.

The code snippet in Example 7-6 defines the procedure generate_anon(), which performs these tasks:

  • Selects the original content dicom and the column anonDicom of the table medical_image_table with the identifier source_id.

  • Generates an ORDDicom object in the column anonDicom by calling the makeAnonymous( ) method on the dicom in the source row.

If you run this code snippet, replace the temporary UID for the variable dest_sop_instance_uid in the procedure generate_anon with a globally-unique UID.

The code statement in Example 7-6 where the makeAnonymous( ) method is called is highlighted in bold.

Example 7-6 Populate the Column and Generate an Anonymous ORDDicom Object

-- Set Data Model Repository
 
execute ordsys.ord_dicom.setDataModel();
 
create or replace procedure generate_anon(source_id number) is
    dcmSrc    ordsys.orddicom;
    anonDst   ordsys.orddicom;
    dest_sop_inst_uid varchar2(128) := '1.2.3';
 
begin
  select dicom, anonDicom into dcmSrc, anonDst from medical_image_table
         where id = source_id for update;
  dcmSrc.makeAnonymous(dest_sop_inst_uid, anonDst);
  update medical_image_table set anonDicom = anonDst where id = source_id;
  commit;
end;
/
 
-- Generate an Anonymous Copy of our test DICOM
execute generate_anon(1);
 
-- look at our handiwork
select id, 
        extractValue(t.anonDicom.metadata, 
        '/DICOM_OBJECT/*[@name="Patient''s Name"]/VALUE', 
        'xmlns=http://xmlns.oracle.com/ord/dicom/metadata_1_0') as "PATIENT_NAME", 
        extractValue(t.anonDicom.metadata, 
        '/DICOM_OBJECT/*[@name="Patient ID"]', 
        'xmlns=http://xmlns.oracle.com/ord/dicom/metadata_1_0') as "PATIENT_ID" 
from medical_image_table t;

Running Example 7-6 generates the following output:

ID PATIENT_NAME                    PATIENT_ID
--- ------------------------------ ----------
 1  Joe^Smith                      anonymous

7.4.4 Checking the Conformance of ORDDicom Objects

This section shows how to check the conformance of ORDDicom objects against a set of user-specified constraint rules. Constraint rules are specified in one or more constraint documents. These XML documents specify attribute relationships and semantic constraints that cannot be expressed by the DICOM metadata schema.

A default constraint document, ordcmct.xml, is loaded during installation. You can create a customized constraint document, but that topic is beyond the scope of this example. This example uses the default constraint document.

Example 7-7 checks the conformance of the column dicom of the table medical_image_table.

The code statement in Example 7-7 where this task is performed is highlighted in bold.

Example 7-7 Check DICOM Conformance

-- Set Data Model Repository
execute ordsys.ord_dicom.setDataModel();
 
select id, t.dicom.isconformanceValid('OracleOrdObject') as conformant
from medical_image_table t;

Running Example 7-7 generates the following output:

ID  CONFORMANT
--- ----------
1     1

If the DICOM content used in this example had not conformed to the Oracle default constraint definitions, a message or messages would have been inserted into a table that you can see by querying the information view orddcm_conformance_vld_msgs. This view lists the constraint messages generated during constraint validation.

The following code snippet shows the description of this view:

SQL> describe orddcm_conformance_vld_msgs;

 Name                         Null?          Type
 ----------------------    -------------    ---------------------
 SOP_INSTANCE_UID                            VARCHAR2(128 CHAR)
 RULE_NAME                  NOT NULL         VARCHAR2(64 CHAR)
 MESSAGE                                     VARCHAR2(1999 CHAR)
 MSG_TYPE                   NOT NULL         VARCHAR2(20 CHAR)
 MSG_TIME                   NOT NULL         TIMESTAMP(6)

Because the DICOM content used in this example conformed with the Oracle constraint rules, there are no messages in the orddcm_conformance_vld_msgs view.

select * from orddcm_conformance_vld_msgs;

Thus, invoking the preceding select query generates the following output:

no rows selected

See Section 3.9 for information about what to do if your DICOM content does not conform to the constraint rules defined for your organization.

7.4.5 Handling Oracle Multimedia DICOM Exceptions in PL/SQL

Possible errors that can occur during run time should always be handled in your application. This practice enables the program to continue its operation even when it encounters a run-time error. This practice also enables users to know what went wrong during program operation. Proper error handling practices ensure that, whenever possible, you will always be able to recover from an error while running an application. In addition, proper error handling provides you with the information you need so that you will always know what went wrong.

When handling exceptions, PL/SQL uses exception blocks. For example, in PL/SQL, the exception may appear as:

BEGIN
<some program logic>
EXCEPTION
     WHEN OTHERS THEN
     <some exception logic>
END;

When you design, code, and debug your application, you are aware of the places in your program where processing might stop due to a failure to anticipate an error. Those are the places in your program where you must add exception handling blocks to handle the potential errors. For more information about handling PL/SQL exceptions, see Oracle Database PL/SQL Language Reference.

7.5 Developing DICOM Applications Using the DICOM Java API

Developers who are familiar with Java and Java database connectivity (JDBC) can write DICOM applications using Oracle Multimedia DICOM Java API. The OrdDicom class in Oracle Multimedia DICOM Java API is the Java proxy class for the ORDDicom database object. This class enables users to write Java applications using the Oracle Multimedia object designed to store Digital Imaging and Communications in Medicine (DICOM) content.

This Java class is included in the oracle.ord.dicom.* package. This class is used to represent an instance of the ORDSYS.ORDDicom database object type in a Java application.

See Oracle Multimedia DICOM Java API Reference for details about the available methods in this class.

7.5.1 Setting Up Your Environment Variables

Before you can begin using Oracle Multimedia DICOM Java API, you must set up your environment to compile and run Java programs.

First, you must specify the environment variable CLASSPATH. In addition, you must ensure that it includes the appropriate Oracle Java libraries for the Oracle Multimedia and other features you intend to use. For each Java library, the following table lists the name of the Java library, the Oracle Multimedia or other features that require that library, details about the JDK version that supports the library, the platform, and the path name under the <ORACLE_HOME> directory where you can obtain the library JAR file.

Name of Oracle Java Library Related Feature JDK Version, Platform, and Location
Oracle JDBC library All Oracle Multimedia features JDK 5 or later, on Linux and UNIX:

<ORACLE_HOME>/jdbc/lib/ojdbc5.jar

JDK 5 or later, on Windows:

<ORACLE_HOME>\jdbc\lib\ojdbc5.jar

Oracle Multimedia Java classes library All Oracle Multimedia features JDK 5 or later, on Linux and UNIX:

<ORACLE_HOME>/ord/jlib/ordim.jar

JDK 5 or later, on Windows:

<ORACLE_HOME>\ord\jlib\ordim.jar

Oracle Multimedia DICOM Java classes library DICOM feature JDK 5 or later, on Linux and UNIX:

<ORACLE_HOME>/ord/jlib/orddicom.jar

JDK 5 or later, on Windows:

<ORACLE_HOME>\ord\jlib\orddicom.jar

Oracle XDB Java classes library DICOM feature

Oracle Multimedia metadata extraction

JDK 5 or later, on Linux and UNIX:

<ORACLE_HOME>/rdbms/jlib/xdb.jar

JDK 5 or later, on Windows:

<ORACLE_HOME>\rdbms\jlib\xdb.jar

Oracle Multimedia Java classes for servlets and JSP library Java servlets and JSP applications JDK 5 or later, on Linux and UNIX:

<ORACLE_HOME>/ord/jlib/ordhttp.jar

JDK 5 or later, on Windows:

<ORACLE_HOME>\ord\jlib\ordhttp.jar

NLS Character Set Conversion library(Optional) <ORACLEHOME>/jlib/orai18n.jar NLS character set conversion requiredFoot 1  JDK 5 or later, on Linux and UNIX:

<ORACLE_HOME>/jlib/orai18n.jar

JDK 5 or later, on Windows:

<ORACLE_HOME>\jlib\orai18n.jar


Footnote 1 If NLS character set conversion is required between the client application and the database, you must include the orai18n.jar file in the CLASSPATH variable. If NLS character set conversion is required, but the appropriate library is not specified, character-based attributes of Oracle Multimedia object types may be returned as hex-encoded strings. See Oracle Database JDBC Developer's Guide and Reference for more information about NLS character set conversion.

Note:

If you are using the JDBC OCI driver, you must specify the location of the JDBC OCI shared library in one of the following variables: LD_LIBRARY_PATH (for Linux or UNIX) or PATH (for Windows).

Depending on your platform, store the JDBC OCI shared library at one of the following locations under the <ORACLE_HOME> directory:


<ORACLE_HOME>/lib (for libocijdbc11.so on Linux and UNIX)
<ORACLE_HOME>\bin (for ocijdbc11.dll on Windows)

Because this library path is shared, it may have been specified previously to enable the use of other client applications such as SQL*Plus.

7.5.2 Importing Oracle Java Classes into Your Application

After setting up your environment variables and including the appropriate Oracle Java libraries, you must include the appropriate import statements into your Java application before using Oracle Multimedia DICOM Java API.

Execute the following statements to import the required classes from the oracle.ord.dicom.* package and the oracle.ord.im.* package:

import oracle.ord.dicom.OrdDicom;
import oracle.ord.im.OrdImage;

Along with the standard JDBC classes included in the java.sql package, you must also import the Oracle JDBC extension class oracle.jdbc.OracleResultSet, with the following statement:

import oracle.jdbc.OracleResultSet;

7.5.3 Handling Oracle Multimedia DICOM Exceptions in Java

Possible errors that can occur during run time should always be handled in your application. This practice enables the program to continue its operation even when it encounters a run-time error. This practice also enables users to know what went wrong during program operation. Proper error handling practices ensure that, whenever possible, you will always be able to recover from an error while running an application. In addition, proper error handling provides you with the information you need so that you will always know what went wrong.

When handling exceptions, Java uses the try/catch block. For example, in Java, the exception may appear as:

try {
    //<some program logic>)
}
catch (exceptionName a) {
//Exception logic
}
finally {
//Execute logic if try block is executed even if an exception is caught
}

When you design, code, and debug your application, you are aware of the places in your program where processing might stop due to a failure to anticipate an error. Those are the places in your program where you must add exception handling blocks to handle the potential errors. For more information about handling Java exceptions, see Oracle Database Java Developer's Guide and Oracle Database JDBC Developer's Guide and Reference.