![]() |
![]() |
|
WebLogic Frequently Asked Questions: WebLogic jDriver for Oracle
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:
/weblogic/bin and /weblogic/bin/client_library_version (for example, /weblogic/bin/oci734_7) + ORACLE_HOME/version/lib
/weblogic/lib/solaris and /weblogic/lib/solaris/client_library_version (for example, /weblogic/lib/solaris/oci734_7) + ORACLE_HOME/version/lib
/weblogic/lib/solaris and /weblogic/lib/solaris/client_library_version (for example, /weblogic/lib/hpux11/oci734_7)+ ORACLE_HOME/version/lib
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.
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 WebLogic jDriver for 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 WebLogic jDriver for 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 WebLogic jDriver for Oracle. Any clues?
WebLogic jDriver for 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.
Using multibyte character sets with WebLogic jDriver for Oracle
I am having trouble using Unicode codesets with the WebLogic jDriver for 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:
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.
How do I use OS authentication with WebLogic jDriver for 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
WebLogic jDriver for Oracle. How can I do that?
Due to an OCI bug, WebLogic Server does not support OS Authentication on
Solaris. Other operating systems, such as HP-UX and NT, are supported.
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 WebLogic jDriver for 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.
OS_AUTHENT_PREFIX = OPS$
Note that the string "OPS$" is arbitrary and up to the DBA.
Once the userid has been set up, you can connect with WebLogic jDriver for 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 WebLogic jDriver for 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?
WebLogic jDriver for Oracle always returns a Java object that will preserve the
precision of the data retrieved. With Release 2.5 and later, WebLogic
jDriverWebLogic jDriver for Oracle returns the following from the getObject()
method:
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.
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 T3 applications 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.
How can I call Oracle stored procedures that take no parameters?
I'm working with the CallableStatement methods for the WebLogic jDriver for
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 WebLogic jDriver for 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 WebLogic jDriver for 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 (?).
How do I know what codesets I have available in Oracle?
When I am using the WebLogic jDriver for 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:
VALUE
-------------------------------------------------------------
AL24UTFFSS
Additional codesets can be added using Oracle's installation tools. Contact Oracle for more information.
What do I do with an "ORA" SQLException?
I am having a problem with my WebLogic jDriver for Oracle application that is
producing a SQLException. There is an Oracle ID number in it that I do not recognize.
How do I look this up? Here is an example:
java.sql.SQLException: ORA-12536: TNS: operation would block
You can look up an Oracle error by using the oerr command. For example, the
description of error ORA-12536 can be found with the command:
> oerr ora 12536
What does the error "ORA-6502" mean?
I'm using WebLogic jDriver for Oracle. I'm getting the error "ORA-6502: value
or numeric error" as the result of a stored procedure, using a CallableStatement. What
does this mean?
The default length of a string bound to an OUTPUT parameter of a CallableStatement
is 128 characters. If the value you assign to the bound parameter exceeds that length,
you will get this error.
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.
Why would I get an error while trying to retrieve the text for ORA-12705?
I'm using WebLogic jDriver for Oracle and getting the following error:
Error while trying to retrieve text for error ORA-12705
This error occurs when you have not set the ORACLE_HOME environment variable properly - a common mistake. In order to use WebLogic jDriver for Oracle, the Oracle client software needs to be installed and ORACLE_HOME must be set.
You may also see this error message if you try to use WebLogic jDriver for 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.
When I update my database using Oracle database link I run out of resources
When I use Oracle's database link to update my database, temporary table locks
are created and the server runs out of resources. The error I get is "maximum number
of temporary table locks exceeded". I'm careful to close my result sets and statements
when I've finished. What is going on?
The database link is an object in the local database that allows you to access tables,
views, and such in a remote database. The database link is controlled by the Oracle
server, so the driver has no control over its use of resources. What happens is the link
appears to perform the commit (since other processes could see the records that were
being created) but it doesn't free any resources until the connection is closed. The
solution is to remove the database link and use the JDBC driver to do your selects,
inserts, and updates.
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|