📄 readme_jdbc.txt
字号:
Setting Up Your Environment---------------------------On Win95/Win98/NT: - Add [ORACLE_HOME]\jdbc\lib\classes111.zip and [ORACLE_HOME]\jdbc\lib\nls_charset11.zip to your CLASSPATH. (Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.) - Make sure [ORACLE_HOME]\bin is in your PATH.On Solaris/Digital Unix: - Add [ORACLE_HOME]/jdbc/lib/classes111.zip and [ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH. (Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.) - Add [ORACLE_HOME]/jdbc/lib to your LD_LIBRARY_PATH.On HP/UX: - Add [ORACLE_HOME]/jdbc/lib/classes111.zip and [ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH. (Add classes12.zip and nls_charset12.zip if JDK 1.2.x or 1.3 is used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.) - Add [ORACLE_HOME]/jdbc/lib to your SHLIB_PATH and LD_LIBRARY_PATH.On AIX: - Add [ORACLE_HOME]/jdbc/lib/classes111.zip and [ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH. (Add classes12.zip and nls_charset12.zip if JDK 1.2.x 1.3 is used. Add ojdbc14.jar and nls_charset12.zip if JDK 1.4 is used.) - Add [ORACLE_HOME]/jdbc/lib to your LIBPATH and LD_LIBRARY_PATH.Some Useful Hints In Using the JDBC Drivers-------------------------------------------Please refer to "JDBC Developer's Guide and Reference" for detailsregarding usage of Oracle's JDBC Drivers. This section only offersuseful hints. These hints are not meant to be exhaustive.These are a few simple things that you should do in your JDBC program: 1. Import the necessary JDBC classes in your programs that use JDBC. For example: import java.sql.*; import java.math.*; 2. Register the Oracle driver before before calling other JDBC APIs. (This is not needed if you are using the JDBC Server-side Internal Driver because registration is done automatically in the server.) To register the Oracle driver, make sure the following statement is executed at least once in your Java session: DriverManager.registerDriver( new oracle.jdbc.OracleDriver()); 3. Open a connection to the database with the getConnection call. Different connection URLs should be used for different JDBC drivers. The following examples demonstrate the different URLs. For the JDBC OCI Driver: Connection conn = DriverManager.getConnection( "jdbc:oracle:oci:@<database>", "my_user", "my_password"); where <database> is either an entry in tnsnames.ora or a SQL*net name-value pair. For the JDBC Thin Driver, or Server-side Thin Driver: Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@<database>", "my_user", "my_password"); where <database> is either a string of the form <host>:<port>:<sid>, a SQL*net name-value pair, or a service name. For the JDBC Server-side Internal Driver: Connection conn = DriverManager.getConnection( "jdbc:oracle:kprb:"); Note that the trailing ':' character is necessary. When you use the Server-side Internal Driver, you always connect to the database you are executing in. You can also do this: Connection conn = new oracle.jdbc.OracleDriver().defaultConnection();New Package oracle.jdbc-----------------------Beginning in Oracle 9i, the Oracle extensions to JDBC are captured inthe package oracle.jdbc. This package contains classes and interfacesthat specify the Oracle extensions in a manner similar to the way theclasses and interfaces in java.sql specify the public JDBC API.Your code should use the package oracle.jdbc instead of the packageoracle.jdbc.driver used in earlier versions of Oracle. Use of thepackage oracle.jdbc.driver is now deprecated, but will be supportedfor backwards compatibility.All that is required to covert your code is to replace"oracle.jdbc.driver" with "oracle.jdbc" in the source andrecompile. This cannot be done piecewise. You must convert all classesand interfaces that are referenced by an application. Conversion isnot required, but is highly recommended. Future releases of Oracle willhave features that are incompatible with use of the packageoracle.jdbc.driver.The purpose of this change in to enable the Oracle JDBC drivers tohave multiple implementations. In all releases up to and includingOracle 9i, all of the Oracle JDBC drivers have used the same top levelimplementation classes, the classes in the packageoracle.jdbc.driver. By converting your code to use oracle.jdbc, youwill be able to take advantage of future enhancements that usedifferent implementation classes. There are no such enhancements inOracle 9i, but there are plans for such enhancements in the future.Additionally, these interfaces permit the use of some code patternsthat are difficult to use when your code uses the packageoracle.jdbc.driver. For example, you can more easily develop wrapperclasses for the Oracle JDBC classes. If you wished to wrap theOracleStatement class in order to log all SQL statements, you couldeasily do so by creating a class that wraps OracleStatment. That classwould implement the interface oracle.jdbc.OracleStatement and hold anoracle.jdbc.OracleStatement as an instance variable. This wrappingpattern is much more difficult when your code uses the packageoracle.jdbc.driver as you cannot extend the classoracle.jdbc.driver.OracleStatement. In implementing a Connectionwrapper class, you should either inherit from the classoracle.jdbc.OracleConnectionWrapper, or base your class on that class.The source for oracle.jdbc.OracleConnectionWrapper is included in thedemos directory.Once again, your code should use the new package oracle.jdbc insteadof the package oracle.jdbc.driver. Conversion is not required asoracle.jdbc.driver will continue to be supported for backwardscompatibility. Conversion is highly recommended as there will in laterreleases be features that are not supported if your code usesoracle.jdbc.driver.Java Stored Procedures----------------------Please note that examples for callins and instance methods using Oracle8 Object Types are provided in: [ORACLE_HOME]/javavm/demo/demo.zipOnce unzipped, the directory containing the examples is: [ORACLE_HOME]/javavm/demo/examples/jspKnown Problems/Limitations In This Release------------------------------------------The following is a list of known problems/limitations: * There is a limitation regarding the use of stream input for LOB types. Stream input for LOB types can only be used for 8.1.7 or later JDBC OCI driver connecting to an 8.1.7 or later Oracle server. The use of stream input for LOB types in all other configurations may result in data corruption. PreparedStatement stream input APIs include: setBinaryStream(), setAsciiStream(), setUnicodeStream(), setCharacterStream() and setObject(). * Programs can fail to open 16 or more connections using our client-side drivers at any one time. This is not a limitation caused by the JDBC drivers. It is most likely that the limit of per-process file descriptors is exceeded. The solution is to increase the limit. * The Server-side Internal Driver has the following limitation: - Data access for LONG and LONG RAW types is limited to 32K of data. - Inserts of Object Types (Oracle Objects, Collections and References) will not work when the database compatibility mode is set to 8.0. This limitation does not apply when the compatibility mode is set to 8.1. - In a chain of SQLExceptions, only the first one in the chain will have a getSQLState value. - Batch updates with Oracle 8 Object, REF and Collection data types are not supported. * The JDBC OCI driver on an SSL connection hangs when the Java Virtual Machine is running in green threads mode. A work-around is to run the Java Virtual Machine in native threads mode. * Date-time format, currency symbol and decimal symbols are always presented in American convention. * When using OracleStatement.defineColumnType(), it is not necessary to define the column type to be the same as the column type declared in the database. If the types are different, the retrieved values are converted to the type specified in defineColumnType. Note: Most reasonable conversions work, but not all. If you find a conversion that you think is reasonable, but that does not work, please submit a TAR to Oracle Support. * The utility dbms_java.set_output or dbms_java.set_stream that is used for redirecting the System.out.println() in JSPs to stdout SHOULD NOT be used when JDBC tracing is turned on. This is because the current implementation of dbms_java.set_output and set_stream uses JDBC to write the output to stdout. The result would be an infinite loop. * The JDBC OCI and Thin drivers do not read CHAR data via binary streams correctly. In other word, using getBinaryStream() to retrieve CHAR data may yield incorrect results. A work-around is to use either getCHAR() or getAsciiStream() instead. The other alternative is to use getUnicodeStream() although the method is deprecated.BUG-899078 (since 8.1.6) The JDBC Server-side Internal driver has extra space padding with PL/SQL CHAR OUT (2 to 3 space depending on character set). Problem occurs in most of the multibyte database character set except UTF8. * There is a limitation for Triggers implemented in Java and Object Types. It only affects the IN argument types of triggers implemented using Java on the client-side. The restriction does not apply to JDBC programs running inside the server. Triggers implemented as Java methods cannot have IN arguments of Oracle 8 Object or Collection type. This means the Java methods used to implement triggers cannot have arguments of the following types: - java.sql.Struct - java.sql.Array - oracle.sql.STRUCT - oracle.sql.ARRAY - oracle.jdbc2.Struct - oracle.jdbc2.Array - any class implementing oracle.jdbc2.SQLData or oracle.sql.CustomDatum * The scrollable result set implementation has the following limitation: - setFetchDirection() on ScrollableResultSet does not do anything. - refreshRow() on ScrollableResultSet does not support all combinations of sensitivity and concurrency. The following table depicts the supported combinations. Support Type Concurrency ------------------------------------------------------- no TYPE_FORWARD_ONLY CONCUR_READ_ONLY no TYPE_FORWARD_ONLY CONCUR_UPDATABLE no TYPE_SCROLL_INSENSITIVE CONCUR_READ_ONLY yes TYPE_SCROLL_INSENSITIVE CONCUR_UPDATABLE yes TYPE_SCROLL_SENSITIVE CONCUR_READ_ONLY yes TYPE_SCROLL_SENSITIVE CONCUR_UPDATABLEBUG-1516862 (since 9.0.0) Passing an OPAQUE type as an argument to a Java Stored Procedure does not work.BUG-1542130 (since 9.0.0) The use of OciConnectionPool may cause a hang in a multi-threaded environment.BUG-1640110 (since 9.0.0) The JDBC OCI driver may hang when executing a query with invalid double quotes in the query string. This problem only occurs when the NLS_LANG environment variable is set. * Access to the new Datetime datatypes is only supported in the Jdbc Thin driver with JDK 1.2, 1.3 and 1.4. These Datetime data types inlcude: TIMESTAMP, TIMESTAMPTZ and TIMESTAMPLTZ. In addition, String APIs like PreparedStatement.setString() and Resultset.getString() do not work for these data types. Users must use setTIMESTAMP*() and getTIMESTAMP*().BUG-2171766 (since 9.2.0) When writing JDBC code that contains SQL method invocations, the syntax " ?.method(args,...) " results in the SQL error message: ORA-01036: illegal variable name/number. This message is somewhat misleading. What is required is that the ? must be followed by a " " (space) to avoid this issue.BUG-2165794 (since 9.2.0) DBC XA applications needing to use TMSUSPEND & TMRESUME features need to use the TMNOMIGRATE FLAG. If this flag is not used, the application may @receive Error ORA 1002: fetch out of sequence.BUG-2158394 (since 9.2.0) ORA-6505 when setting null to char column via stored procedure using setNull() method with java.sql.Types.CHAR. Using java.sql.Types.VARCHAR, is ok. Only occurs with Thin driver and JA16SJIS or JA16EUC character sets. BUG-2148328 (since 9.2.0) On Linux, SJIS data in table names are returned as replacement characters with JDK1.2 and JDK1.3 with both the Thin and OCI drivers. This is due to a bug in the JDKs. The workaround is to use JDK 1.1.8, which does not have this bug.BUG-2144602 (since 8.1.7) When running Windows2000 with the locale set to Chinese (Taiwan) and the character set set to ZHT16DBT, all Chinese characters are displayed as "?".BUG-2130384 (since 9.0.1) Does not raise ORA-22814 as it should when inserting too large of an element value into a VARRAY using setARRAY.BUG-2249191 In the Server Internal Driver, setting the query timeout does not (and likely will never) work. The query execution will not be canceled when the timeout expires, even if the query runs forever. Further, after the query returns, the execution of your code may pause for the length of the timeout.BUG-2213820 OracleConnectionCacheImpl cannot be serialized because it has a member that is not serializable. This causes some problems with JSPs that store the connection cache as a bean in session scope.BUG-2180673 When using OracleOCIConnectionPool, the methods getPoolSize and getActiveSize return the wrong results. getPoolSize always returns minLimit and getActiveSize always returns 0.BUG-1910217 TIMESTAMPs are not supported in ADTs.BUG-2245502 If you use the Thin driver to connect to an 8.1.7 database, and then attempt to access a 7.3.4 database via DBLinks using bind variables, the values of the bind variables may be swapped.BUG-2183691 The insertRow method on an updateable result set inserts the row into the database, but does not insert it into the result set itself. BUG-2095829 In the Server Internal Driver, calling a PL/SQL procedure and passing a NULL value to an argument of a user defined type fails. In some cases the session hangs, in others you will get ora-3113, ora-3114, or ora-24323.BUG-1568923 Using the OCI driver, using setBytes to insert more than 50K into a LONG RAW truncates the inserted value.BUG-2285052 (since 9.2.0.1) Extra space and null characters are returned by ResultSet.getString() and Scrollable ResultSet getString() for NCHAR column when the database national character set is UTF8. This behavior occurs only with JDBC THIN driver.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -