BEA Logo BEA WebLogic Server Release 5.0

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

Technical FAQ: Questions about jDriver for Oracle

FAQ Index

Error using FOR UPDATE statement with Oracle 8

Q 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?

A 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.

Top of the page

OCIW32.DLL error

Q 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"

A 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.

Top of the page

Doesn't the jDriver for Oracle driver support all of the transaction isolation levels?

Q Our servlet application uses the Oracle JDBC thin drivers to access a database that includes BLOB fields. We installed 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 jDriver for Oracle. Any clues?

A 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.

Top of the page

Running Oracle under HP-UX 10.x

Q We're running Oracle on HP-UX 10.2. Can we use jDriver for Oracle?

A jDriver for 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 jDriver for Oracle with HP-UX 11.0 with the latest available JDK and HP patches.

See the next FAQ for more information about jDriver for Oracle on HP-UX 11.0.

Top of the page

Running Oracle under HP-UX 11.0

Q 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 jDriver for Oracle on HP-UX 11.0. What's going on?

A You need to install Oracle 8.0.4 client libraries. jDriver for 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.

Top of the page

Using multibyte character sets with jDriver for Oracle

Q I am having trouble using Unicode codesets with the jDriver for Oracle driver. How can I use a codeset in my Oracle database with the WebLogic JDBC drivers?

A There are two important things you must do to use Unicode codesets:

  1. 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.
  2. You must define the NLS_LANG variable in the environment where the JDBC 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.

Top of the page

Do you support Oracle 8?

Q 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?

A See the WebLogic Platforms page for details on Oracle client and server support.

Top of the page

What version of Oracle client/server does jDriver for Oracle require?

jDriver for 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, jDriver for Oracle is built with Oracle OCI version 7.3.4. (On HP-UX 11.0, jDriver for Oracle uses the Oracle 8 client.) At the very least, you must run jDriver for 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.

Top of the page

Using jDriver for Oracle with Oracle 7.x client libraries and Oracle 8

Q I am using jDriver for Oracle 3.0.x and Oracle 7.x client libraries with Oracle 8. How do I connect the 7.x product to the Oracle 8?

A 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.

Top of the page

Hanging problem with Oracle 7.3.3 and jDriver for Oracle on Windows NT

A July 1997: We have had reports of problems with jDriver for 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 jDriver for Oracle Release 3.0 and later.

Top of the page

Can I use jDriver for Oracle with IBM's VisualAge for Java?

Q Does the WebLogic jDriver for Oracle driver work with IBM VisualAge for Java?

A Because of a bug in VisualAge JNI, jDriver for Oracle does not currently work with VisualAge for Java. The jDriver for 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.

Top of the page

Does jDriver for Oracle work with Oracle 7.3?

Q Does the WebLogic jDriver for 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?

A Yes, jDriver for 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. jDriver for Oracle should take advantage of the MTS, since this functionality is below the level of OCI and SQLNet.

Top of the page

How do I use OS authentication with jDriver for Oracle and WebLogic JDBC connection pools?

Q 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 jDriver for Oracle. How can I do that?

A 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 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.

  1. 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.

  2. Log in to the Oracle server as SYSTEM.

  3. 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 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 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.

Top of the page

What type of Object is returned by ResultSet.getObject()?

Q 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?

A jDriver for Oracle always returns a Java object that will preserve the precision of the data retrieved. With Release 2.5 and later, jDriver for Oracle 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.

Top of the page

Can I use SQL*Net V1 with jDriver for Oracle?

Q Will SQL*Net V1 work with the 2.5 release of WebLogic's software, specifically the JDBC drivers?

A 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 jDriver for 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.

Top of the page

Personal Oracle and Windows95

Q 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?

A You must be using the Oracle 7.3 client libraries in order to use jDriver for Oracle with Windows 95.

Top of the page

How do I limit the number of Oracle database connections?

Q 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?

A 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.

Top of the page

Why am I running out of allocated processes in Oracle?

Q 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?

A 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 jDriver for 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 JDBC drivers use the Oracle 7.2 OCI libraries.

Top of the page

I'm getting back integers instead of doubles from an Oracle number column

Q 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.

A WebLogic jDriver for 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.

Top of the page

How can I call Oracle stored procedures that take no parameters?

Q I'm working with the CallableStatement methods for the 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?

A 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.

Top of the page

How do I bind String values in a PreparedStatement?

Q I'm using 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();

A 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();
Top of the page

Using 8-bit character sets with Oracle/Solaris

Q I'm using jDriver for Oracle on Solaris with an 8-bit character set, but I'm not seeing the characters I expect. What's the problem?

A 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 (?).

Top of the page

Using Oracle JDBC drivers with a non-English codeset

Q I'm using the jDriver for 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?

A 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.

Top of the page

How do I know what codesets I have available in Oracle?

Q When I am using the jDriver for Oracle driver with my Oracle database, how can I find out what foreign language codesets I can access and use?

A 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.

Top of the page

What do I do with an "ORA" SQLException?

Q I am having a problem with my 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

A 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

Top of the page

What does the error "ORA-6502" mean?

Q I'm using 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?

A 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.

Top of the page

Why would I get an error while trying to retrieve the text for ORA-12705?

Q I'm using jDriver for Oracle and getting the following error:

Error while trying to retrieve text for error ORA-12705
What does this mean?

A This error occurs when you have not set the ORACLE_HOME environment variable properly -- a common mistake. In order to use 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 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.

Top of the page

AIX JDK 1.1.2 and jDriver for Oracle

Q I'm using AIX JDK 1.1.2 with jDriver for Oracle and I get the following Exception:

  java.lang.ExceptionInInitializerError

When I run dbping, I get this message:

  java.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getConnection(DriverManager.java:111)
        at utils.dbping.main(dbping.java:52) 

What's going on?

A The AIX JDK 1.1.2 does not invoke a static block when the Class.forName() method is used. The static block needs to be called for a driver to register with the DriverManager. The problem and solution are similar to the one for using IE3.01. Load the JDBC driver by calling the Driver.connect() method directly in your code, instead of invoking Class.forName. Here is an example:

  Driver d = new weblogic.jdbd.oci.Driver();
  Connection conn = d.connect("jdbc:weblogic:oracle",props);

Also see Why do I get a "No suitable driver" message using IE3.01? in this document for more information about Class.forName and static blocks.

Top of the page

When I update my database using Oracle database link I run out of resources.

Q 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?

A 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 jdbc/Kona 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.

Top of the page

Connection failures using Oracle and the 8859-9 codeset

Q We're using your Oracle JNI jDriver for Oracle drivers on HP-UX 11.x. The Oracle server is running version 7.3.2 and is using a 8859-9 (WE8ISO8859P9) codeset. When a client tries to connect, we get a connection failure (Oracle error message ORA-24365). What's the problem?

A There are several problems. The Oracle 7.3.2 server doesn't support AL24UTFFSS (UTF-8) codesets, which is the codeset that JDBC uses when the NLS-LANG variable is not set to 8859-1. These codesets are only supported in version 7.3.4 and later for HP-UX 11.x. The WebLogic drivers do not generate 8859-9 codepoints. You will need to upgrade your Oracle server installation to 7.3.4 or later to get the appropriate codeset support.

 

Copyright © 2000 BEA Systems, Inc. All rights reserved.
Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.
Last updated 01/13/2000