Troubleshooting JDBC hangs and SEGVsProblems with OracleSegmentation violation errors (SEGVs) or hangs when using JDBC and an Oracle database can have several causes.
Out-of-memory errorsA common cause of out-of-memory errors is failing to close ResultSets. The error message is usually something like:
To avoid out-of-memory errors, make sure that your program logic closes any ResultSets in all cases. To test whether failing to close ResultSets is causing the out of memory errors, minimize the size of the array fetches so that the amount of C memory allocated for selects is small. You can do this by setting the weblogic.oci.cacheRows property (a JDBC connection property) to a small number. For example, Properties props = new java.util.Properties(); props.put("user", "scott"); props.put("password", "tiger"); props.put("server", "DEMO" ); props.put("weblogic.oci.cacheRows", "1" ); Class.forName("weblogic.jdbc.oci.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:weblogic:oracle", props);If the out of memory errors cease, it is likely that ResultSets are not being closed somewhere in your code. For more information, see Closing JDBC objects, below. Codeset SupportWebLogic has supported Oracle codesets since version 2.5 of WebLogic. Prior to that version, only ASCII characters were supported. In these later versions, support for Oracle codesets is implemented with the following considerations:
Other problems with Oracle on UNIXCheck the threading model you are using. Green threads can conflict with the kernel threads used by OCI. When using Oracle drivers, WebLogic recommends that you use native threads. You can specify this by adding the -native flag when you start Java.If you are using the JVM for Solaris provided by Sun, you might want to switch to JavaSoft's JVM for Solaris, which WebLogic has found to be more stable. General thread-related problems on UNIXOn UNIX, two threading models are available: green threads, and native threads. For more information, see JDK for the Solaris Operating Environment from JavaSoft's website.You can determine what type of threads you are using by checking the environment variable called THREADS_TYPE. If this variable is not set, you can check the shell script in your Java installation bin directory. Some of the problems are related to the implementation of threads in the JVM for each operating system. Not all JVMs handle operating-system specific threading issues equally well. Here are some hints to avoid thread-related problems:
HP UX
General troubleshootingJDK/JIT issuesWebLogic recommends that you use the latest version of JDK 1.1, currently 1.1.6. You can obtain the updated version from JavaSoft (free). Also make sure that you have the latest version of the Just-in-time (JIT) compiler for the JDK 1.1.6.Note that if you are already using JDK 1.1.6, you may need to install the latest version of the JIT. An bug in an early version was fixed and is posted at JavaSoft in the Developer's Club, for which you must register to get access (but it is free). After you have registered, go to: http://developer.javasoft.com/developer/earlyAccess/jit/index.html Closing JDBC objectsWebLogic also recommends -- and good programming practice dictates -- that you always close JDBC objects, like Connections, Statements, and ResultSets, in a finally block to make sure that your program executes efficiently. Here is a general example:try { Class.forName("weblogic.jdbc.oci.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:weblogic:oracle:myserver", "scott", "tiger"); Statement stmt = conn.createStatement(); stmt.execute("select * from emp"); ResultSet rs = stmt.getResultSet(); // do work } catch (Exception e) { // deal with any exceptions appropriate } finally { try {rs.close();} catch (Exception rse) {} try {stmt.close();} catch (Exception sse) {} try {conn.close(); catch (Exception cse) {} } |
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|