Technical FAQ: Questions about jdbcKona/Oracle
FAQ Index
Unsatisfied link error
Why do I receive the following error message when trying to use the WebLogic
jDriver for Oracle: java.sql.SQLException: System.loadLibrary threw
java.lang.UnsatisfiedLinkError with the message 'no weblogicoci36 in
java.library.path'?
WebLogic jDriver for Oracle is of type 2 which requires a native component. The
native component comes as a linked library named weblogicoci3x.dll on Windows
NT or libweblogicoci3x.so (or .sl, .dll, etc., depending on the operating
system) on Solaris. The linked library must be located somewhere that the operating
system will look when an application needs it. WebLogic has an internal variable
called java.library.path. This variable corresponds to an environment variable
that you set in the shell where you run WebLogic. On Windows NT, the
java.library.path corresponds to the PATH environment variable.
At boot-time of the server, WebLogic reads in the values from PATH (for example, c:\winnt;d:\weblogic\bin) and sets these values as equal to the java.library.path internally. On Solaris, Linux and TruUnix, the environment variable is called LD_LIBRARY_PATH, on HPUX it is called SHLIB_PATH and on IBM's AIX it is called LIBPATH. The value that is read into the internal variable java.library.path is the environment variable that you specify at the time WebLogic starts. The java.library.path is where WebLogic looks for the shared library files that it needs to access the database.
On some UNIX platforms, if a call requires library A, the loader does not find and load library A and the loader makes the required native call, and if the native call requires library B and library B is not found, the linker will sometimes say that the top-level library A was not found. For the WebLogic jDriver, library A is libweblogicoci36 and library B might be Oracle's OCI client libs or, below that, it might be Sun's standard C libraries.
To avoid getting the UnsatisfiedLinkError:
- Do not rename libweblogicoci36.so or libweblogicoci36.sl to weblogicoci36.
- Specify the correct path that WebLogic will use to look for the shared library files that it needs to access the database.
- Ensure that you have Oracle's client installed on your machine and that you have Oracle's libraries and the standard C libraries in your LD_LIBRARY_PATH
- Ensure that you have $ORACLE_HOME set to point to the root of your oracle installation, as the Oracle install indicates.
- Ensure that ORACLEHOME/version/lib is in your java.library.path. Your ORACLE_HOME variable must be set even if you are feeding values directly into the java.library.path. For example, if you are going to use the 7.3.4 libraries and your Oracle installation is at /oracle, you need /oracle/7.3.4/lib in your java.library.path.
- For Windows NT/2000:
/weblogic/bin and /weblogic/bin/client_library_version (for example, /weblogic/bin/oci734_7) + ORACLE_HOME/version/lib
- For Solaris:
/weblogic/lib/solaris and /weblogic/lib/solaris/client_library_version (for example, /weblogic/lib/solaris/oci734_7) + ORACLE_HOME/version/lib
- For HPUX11:
/weblogic/lib/solaris and /weblogic/lib/solaris/client_library_version (for example, /weblogic/lib/hpux11/oci734_7)+ ORACLE_HOME/version/lib
- If you are using HPUX 10, you must move to HPUX 11 to use type 2 Oracle drivers with WebLogic Server 5.1.
- If you have ensured all of the above and you still get the UnsatisfiedLinkError:
- You may be specifying improper directories or the files may be corrupted. Run the FILE command on UNIX to assure file integrity.
- Ensure that WebLogic has read and execute permissions on the shared library files.
- Rearrange the order of the paths that you specify for the weblogic.library.path variable trying all possible combinations.
- Put /usr/lib in your java.library.path and add standard C libraries.
- As a last resort, reinstall WebLogic Server, your operating system and your Oracle libraries.
Error using FOR UPDATE statement with Oracle 8
Why have I been receiving the following error message from my Oracle 8
server when using a FOR UPDATE statement: ORA-01002: fetch out of
sequence?
There is a problem in the Oracle 8
server that causes this error when using a FOR UPDATE
statement with AUTOCOMMIT turned on (which is the default state
when using JDBC). This is known to happen on Oracle 8.0 and 8.1 on
Solaris and on Oracle 8.1 on Windows NT. If you turn AUTOCOMMIT
off, you will not receive this error. Since this problem is due
to a change in the Oracle 8 server, you should contact Oracle support
for more information.
OCIW32.DLL error
I have been receiving the following error message when using your JDBC
driver for Oracle: "The ordinal 40 could not be loaded in the dynamic
link library OCIW32.dll"
This problem is caused by an out-of-date version of OCIW32.DLL in your
system directory. Some programs install this file in the system
directory in order to run. If you remove this file from the system
directory you should no longer receive this error.
Doesn't the jdbcKona/Oracle
driver support all of the transaction isolation levels?
Our servlet application uses the Oracle JDBC
thin drivers to access a database that includes BLOB fields. We
installed jdbcKona/Oracle and the same code fails with the following
exception:
com.roguewave.jdbtools.v2_0.LoginFailureException:
TRANSACTION_READ_UNCOMMITTED isolation level not allowed
The Stack Trace:
com.roguewave.jdbtools.v2_0.LoginFailureException:
TRANSACTION_READ_UNCOMMITTED isolation level not allowed
at com.roguewave.jdbtools.v2_0.jdbc.JDBCServer.createConnection
(JDBCServer.java :46)
at com.roguewave.jdbtools.v2_0.ConnectionPool.getConnection_
(ConnectionPool.jav a:412)
at com.roguewave.jdbtools.v2_0.ConnectionPool.getConnection
(ConnectionPool.java :109)
We set the Isolation_level to 1 in our code that calls the
RogueWave JDBCServer class. This works with the Oracle thin driver but
fails with jdbcKona/Oracle. Any clues?
jdbcKona/Oracle supports the following transaction isolation levels:
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
According to the Oracle documentation, the Oracle DBMS only supports
these two isolation levels. Unlike other JDBC drivers, WebLogic's
drivers throw an exception if you try to use an isolation level that
is unsupported. Some drivers silently ignore attempts to set an
unsupported isolation level. WebLogic suggests testing whether the
Oracle thin driver is not just ignoring settings for unsupported
isolation events.
Running Oracle under HP-UX 10.x
We're running Oracle on HP-UX 10.2. Can we use jdbcKona/Oracle?
jdbcKona/Oracle requires HP-UX 11.0. Native threads are not available
on HP-UX 10.2 and there are other problems with the JVMs on that
OS. We recommend that you run jdbcKona/Oracle with HP-UX 11.0 with the
latest available JDK and HP patches.
See the next FAQ for more information about
jdbcKona/Oracle on HP-UX 11.0.
Running Oracle under HP-UX 11.0
When I run dbping to test my connection to Oracle, I get the following
error message:
java.sql.SQLException: ORA-01019: unable to allocate memory in the user
I'm using Oracle server 7.3.4, with Oracle 7.3.4 client libraries and
jdbcKona/Oracle on HP-UX 11.0. What's going on?
You need to install Oracle 8.0.4 client
libraries. jdbcKona/Oracle
drivers running under HP-UX 11.0 require the Oracle 8.0.4 client
environment and a server version of at least 7.3.4.
Also, make sure that the environment variables ORACLE_HOME and
ORACLE_SID are set properly.
Using multibyte character sets
with jdbcKona/Oracle
I am having trouble using Unicode codesets with the jdbcKona/Oracle
driver. How can I use a codeset in my Oracle database with the
WebLogic JDBC drivers?
There are two important things you must do to use Unicode
codesets:
- You must install the appropriate codeset when you install
Oracle. If you did not do this in the original installation, you will
need to re-run the Oracle installer and install the proper codeset.
- You must define the NLS_LANG variable in the environment where the
jdbcKona driver is running. You can do this by assigning the proper
codeset to NLS_LANG in the shell from where you start the WebLogic
Server.
The Developers Guide has more information about internationalization support. For general information
about Unicode see the Unicode website. For a list of Unicode language
abbreviations, see the JavaSoft website.
Using BLOBS with Oracle and Sybase
Do the WebLogic JDBC drivers for Oracle and
Sybase support BLOBs, and do I need to use PL/SQL to handle BLOBs?
WebLogic supports the Oracle LONG data type and the Sybase TEXT and
IMAGE data types when read as a LONG data type or when using one of
the binary stream methods of java.sql.ResultSet. Support for Oracle 8
BLOB and CLOB data will be included in a future release, once the JDBC
2.0
specification is finalized. You do not need to use any PL/SQL to
handle BLOBs.
Do you support Oracle 8?
Do you support Oracle 8? All features, or only a subset, and if so,
which features are supported? Can I use WebLogic to talk to both a 7.3
server and an 8.0 server?
jdbcKona/Oracle works with Oracle 8 databases, but it only supports
the database features in Oracle 7.3.4 and the JDBC 1.2 specification.
To use jdbcKona/Oracle with and Oracle 8 or 7.3.4 database, you must
install the version of the Oracle client library that the
jdbcKona/Oracle native layer was compiled against. In most cases, you
should install the Oracle OCI 7.3.4 client whether you access Oracle 7
or Oracle 8 databases. But be sure to check jdbcKona support for your
platform, since Oracle 8 client libraries are required on some
platforms.
jdbcKona/Oracle
is based on the 7.3.4 OCI library, so only those Oracle 8 features
that are available through the OCI 7.3.4 library and that fit within
the JDBC 1.2
specification are available. In the future, after the JDBC 2.0
specification is released, you can expect jdbcKona/Oracle to support
features like Oracle 8's BLOB And CLOB features.
What version of Oracle client/server does jdbcKona/Oracle require?
jdbcKona/Oracle is based on version 7.3.4 of the Oracle Call Interface
(OCI) for all database operations and therefore inherits the
requirements of any OCI application. According to Oracle, you must use
the same client version as the application was built with. On most
platforms, jdbcKona/Oracle is built with Oracle OCI version 7.3.4. (On
HP-UX 11.0, jdbcKona/Oracle uses the Oracle 8 client.) At the very
least, you must run jdbcKona/Oracle in a 7.3.4 client
environment. According to Oracle, it is also imperative that you are
using a 7.3.4 or higher server as well.
Using jdbcKona with Oracle 7.x client libraries and Oracle 8
I am using jdbcKona 3.0.x and Oracle 7.x client
libraries with Oracle 8. How do I connect the 7.x product to the
Oracle 8?
According to Oracle, the TNSNAMES.ORA file has been moved from
$ORACLE_HOME/network/admin to $ ORACLE_HOME/net80/admin. You will need
to copy the file:
$ORACLE_HOME/net80/admin/tnsnames.ora
to
$ORACLE_HOME/network/admin/tnsmname.ora You will
also need to install SQL*Net 2.3 because some 7.x products may have
problems with Beta versions of 8.x that are installed with Oracle
versions before 8.03.
Hanging problem with Oracle
7.3.3 and jdbcKona/Oracle on Windows NT
July 1997: We have had reports of problems with jdbcKona/Oracle
hanging on Windows NT. We have traced this to the Oracle 7.3.3 client
libraries, which was released in late June 1997.
The solution is to install the 7.3.4 client libraries, which
are required with jdbcKona/Oracle
Release 3.0 and later.
Can I use jdbcKona/Oracle with IBM's VisualAge for Java?
Does the WebLogic jdbcKona/Oracle driver work with IBM VisualAge for Java?
Because of a bug in VisualAge JNI, jdbcKona/Oracle does not currently
work with VisualAge for Java. The jdbcKona/Oracle native layer receives
incorrect values from VisualAge JNI. Until the VisualAge bug is fixed,
you should use a type 4 JDBC driver for Oracle, such as Oracle's own
JDBC driver.
Does jdbcKona/Oracle work with Oracle 7.3?
Does the WebLogic jdbcKona/Oracle driver work with Oracle 7.3? If so,
does it use the multithreading
capability of Oracle 7.3 when making multiple simultaneous connection
with Oracle using the same username?
Yes, jdbcKona/Oracle does work with Oracle 7.3. In fact, for WebLogic
version 2.5.4 and later, we require the use of the Oracle 7.3.4 client
libraries because of several Oracle bugs that were fixed in Oracle's
7.3.4 release. jdbcKona/Oracle should take advantage of the MTS, since
this functionality is below the level of OCI and SQLNet.
How do I use OS authentication
with jdbcKona/Oracle and WebLogic JDBC connection pools?
I'd like to set up a WebLogic JDBC connection pool so that it uses the
authentication associated with the user who is running my client
application. I'm using jdbcKona/Oracle. How can I do that?
Using OS authentication
in connection pools essentially means that you are using the userid
of the user that started the WebLogic Server. This means that
database security will rely strictly on the security of WebLogic; that
is, if you are allowed to make a client connection to the WebLogic
Server and access the pool, then you can get to the database.
You can do this with jdbcKona/Oracle because Oracle uses the process
owner to determine who is attempting the connection. In the case of
WebLogic JDBC, this is always the user that started the WebLogic
Server.
To set up your Oracle instance to use this feature, your DBA needs to
follow these basic steps. The full procedure is described in more
detail in your Oracle documentation.
- Add the following line to the INIT[sid].ORA file:
OS_AUTHENT_PREFIX = OPS$
Note that the string "OPS$" is arbitrary and up to the DBA.
- Log in to the Oracle server as SYSTEM.
- Create a user named OPS$userid, where userid is some
operating system login ID. This user should be granted the standard
privileges (for example, CONNECT and RESOURCE).
Once the userid has been set up, you can connect with jdbcKona/Oracle
by specifying "/" as the username property and "" as the password
property. Here is an example for testing this connection with the dbping utility:
$ java utils.dbping ORACLE "/" "" myserver
Here is a code example for jdbcKona/Oracle:
Properties props = new Properties();
props.put("user", "/");
props.put("password", "");
props.put("server", "myserver");
Class.forName("weblogic.jdbc.oci.Driver").newInstance();
Connection conn =
DriverManager.getConnection("jdbc:weblogic:oracle", props);
Here is how you set up the registration of a connection pool (this one
named "eng") for use with this system:
weblogic.jdbc.connectionPool.eng=\
url=jdbc:weblogic:oracle,\
driver=weblogic.jdbc.oci.Driver,\
initialCapacity=4,\
maxCapacity=10,\
capacityIncrement=2,\
props=user="/";password="";server=myserver
weblogic.allow.reserve.weblogic.jdbc.connectionPool.eng=guest,joe,jill
The second property sets up an access control list for this connection
pool and gives the users "guest," "joe," and "jill" the same database
privileges as the user that started the WebLogic Server.
What type of Object is returned by ResultSet.getObject()?
I am confused about what type of object will be returned by the ResultSet.getObject() method. What
can I expect if my database column is a NUMBER(16,4), or just NUMBER?
jdbcKona always returns a Java object that will preserve the precision
of the data retrieved. With Release 2.5 and later, jdbcKona returns
the following from the getObject() method:
- For columns of types NUMBER(n) and NUMBER(m,n): we return a Double
if the defined precision of the column can be represented by a Double;
otherwise we return BigDecimal.
- For columns of type NUMBER: Because there is no explicit
precision, we determine the Java type to return based on the actual
value in each row, and this may vary from row to row. We will return
an Integer if the value has a zero-valued fractional component and the
value can be represented by an integer.
For example, 1.0000 will be an integer. We will return a long for a
value such as 123456789123.00000. If a value has a non-zero fractional
component we return a Double if the precision of the value can be
represented by a Double; otherwise we return a BigDecimal.
Can I use SQL*Net V1 with jdbcKona/Oracle?
Will SQL*Net V1 work with the 2.5 release of WebLogic's software,
specifically the jdbcKona drivers?
We recommend that you use SQL*Net V2. SQL*Net V1 is no longer included
with the Oracles releases after version 7.3.3. The WebLogic
jdbcKona/Oracle JDBC driver (version 2.5.4 and later) requires the
Oracle 7.3.4 client libraries.
If you do not know what version of SQL*Net you have, or what the
differences between V1 and V2 of SQL*Net are, contact your DBA or
Oracle technical support.
Personal Oracle and Windows95
We have been trying to establish connectivity between Java and
Personal Oracle 7 on Windows95, but we haven't been successful. Is
there a problem with compatibility?
You must be using the Oracle 7.3 client
libraries in order to use jdbcKona/Oracle
with Windows 95.
How do I limit the number of Oracle database connections?
I want to limit the number of Oracle database
connections generated by the WebLogic Server in response to client
requests. How would I do this?
If you want to limit the number of database connections used by the
WebLogic Server, you can use connection pools. Connection pools allow
T3Clients to share a fixed number of database connections. For more
information on how to set up connection pools, see the Developers
Guide, Using WebLogic
JDBC.
Why am I running out of allocated processes in Oracle?
I'm tuning my connections between WebLogic and an Oracle database and
I've used up all of my allocated Oracle processes. The database is
running on a Solaris platform; the client is running Oracle 7.2.x (or
earlier). Why am I exceeding the limit?
In Oracle versions prior to 7.3, Oracle has hardwired a connection
limit in its Oracle Call Interface (OCI) libraries, which WebLogic
uses to implement the jdbcKona/Oracle
drivers. The number of connections allowed by OCI from a given client
varies depending on the Oracle version and platform. For the Solaris
platform there is hardwired limit of 50 connections.
The solution is to upgrade to Oracle 7.3.3 or later. In these later
versions, Oracle has increased the hardwired limit on the number of
connections to much greater than 50. Note that on UNIX platforms you
must also upgrade your WebLogic software to version 2.5 or later,
because earlier versions of the WebLogic jdbcKona driver use the
Oracle 7.2 OCI libraries.
I'm getting back integers
instead of doubles from an Oracle number column
When I use the getObject()
method to retrieve values stored in an Oracle DBMS number column, I
expect to get back doubles, but the values are being returned as
integers. I'm running WebLogic 2.5.1 and JDK 1.1.4 with Oracle 7.3.2.
WebLogic jdbcKona/Oracle
is conservative in converting data types when data is returned with
the getObject() method, to
guard against a loss of precision.
To get back a single data type when retrieving number values from an
Oracle number column, use the getDouble() method to return all of the values as
doubles. If you want more precision, you can use the getBigDecimal() method, but you will
have to state a scale for the values returned, which might involve
rounding some values. Using the getString() method is another option that insures
precision, but it will require more manipulation if you want to do
further calculations.
How can I call Oracle stored
procedures that take no parameters?
I'm working with the CallableStatement methods for the jdbcKona/Oracle
driver and having trouble calling an Oracle procedure that has no
parameters. How can I call a stored procedure with no parameters from
Java?
Here is what we use that works:
CallableStatement cstmt = conn.prepareCall("Begin procName; END;");
cstmt.execute();
where procName is the name of an Oracle stored procedure. This
is standard Oracle SQL syntax that works with any Oracle DBMS. You
might also use the following syntax:
CallableStatement cstmt = conn.prepareCall("{call procName};");
cstmt.execute();
This code, which conforms to the Java Extended SQL spec, will work
with any DBMS, not just Oracle.
How do I bind String values in a PreparedStatement?
I'm using jdbcKona/Oracle. I cannot get the PreparedStatement class to
bind Strings in a statement. The setString() method doesn't seem to
work. Here is how I set up the PreparedStatement:
String pstmt = "select n_name from n_table where n_name LIKE '?%'";
PreparedStatement ps = conn.prepareStatement(pstmt);
ps.setString(1, "SMIT");
ResultSet rs = ps.executeQuery();
You can't bind a value into another value in a PreparedStatement. The
complete value needs to be specified in a String (without using
embedded quotes) and then bound to an unquoted question-mark
(?). Here is the corrected code:
String matchvalue = "smit%";
String pstmt = "select n_name from n_table where n_name LIKE ?";
PreparedStatement ps = conn.prepareStatement(pstmt);
ps.setString(1, matchvalue);
ResultSet rs = ps.executeQuery();
Using 8-bit character sets with Oracle/Solaris
I'm using jdbcKona/Oracle on Solaris with an 8-bit character set, but
I'm not seeing the characters I expect. What's the problem?
If you are using an Oracle database with an 8-bit character set on
Solaris, make sure you set NLS_LANG to the proper value on the client. If NLS_LANG is unset, it defaults to a
7-bit ASCII character set, and tries to map characters greater than
ASCII 128 to a reasonable approximation (for example, á,
à, â would all map to a). Other characters are mapped to
a question mark (?).
Using Oracle JDBC drivers with a non-English codeset
I'm using the jdbcKona/Oracle
driver with an Oracle server that is based on a non-English
codeset. Most characters that I insert or select pass through the
driver fine, but certain characters are changed. Why is that?
Our drivers depend on the Oracle client software to do codeset
conversion. For certain codesets -- especially multibyte codesets --
the Oracle codeset conversion tables are incomplete or invalid. This
mainly pertains to multibyte codesets. If your Oracle client
installation is older than version 7.3.3, we suggest that you upgrade
to the latest version of the Oracle client software.
How do I know what codesets I
have available in Oracle?
When I am using the jdbcKona/Oracle driver with my Oracle database,
how can I find out what foreign language codesets I can access and
use?
To find out what codesets you currently have available in Oracle,
execute the following SQL query from SQLPlus at the command line:
SQL> SELECT value FROM v$nls_valid_values
WHERE parameter='CHARACTERSET';
The response will be a listing of all of the codesets currently
installed on your system. This listing will look something like the
following shortened list:
VALUE
-----------------------------------------------------------
US7ASCII
WE8DEC
WE8HP
US8PC437
WE8EBCDIC37
WE8EBCDIC500
WE8EBCDIC285
...
If you want to constrain the value in the query to a specific codeset
you are searching for, you might use a SQL query like the following:
SQL> SELECT value FROM v$nls_valid_values
WHERE parameter='CHARACTERSET' and VALUE='AL24UTFFSS';
This would produce the following response if the codeset is installed:
You can adjust the length of the value of the bound parameter by
passing an explicit length with the scale argument to the CallableStatement.registerOutputParameter() method.
You may also see this error message if you try to use
jdbcKona/Oracle's internationalization capabilities with a
language/codeset combination that is not installed on your system. If
you get the ORA-12705 error with the correct error text, then either
you have set NLS_LANG
improperly, or you do not have the right codesets installed on your
system.