A problem with weblogic connecting to the oracle database

Source: Internet
Author: User
Recently, when developing a system, I encountered a problem. The following is a problem: the test environment calls the function of generating scores in the stored procedure, and the test fails, while the system can be generated normally in the local environment. Test environment: Release the class code library to the weblogic Server, configure the data source for weblogic, connect to and test the oracle database, and release the test environment.

Recently, when developing a system, I encountered a problem. The following is a problem: the test environment calls the function of generating scores in the stored procedure, and the test fails, while the system can be generated normally in the local environment. Test environment: Release the class code library to the weblogic Server, configure the data source for weblogic, connect to and test the oracle database, and release the test environment.

Recently, when developing a system, I encountered a problem, which is described as follows:

In the test environment, the score generation function of the stored procedure is called, and the test fails, while the score can be generated normally in the local environment.

Test environment: Release the class code library to the weblogic Server, configure the data source for weblogic, connect to and test the oracle database, and release the test environment.

Local Environment: Compile the local code and publish it to the local weblogic. weblogic configures the data source, connects to and tests the oracle database, and releases the local environment.

Analysis: The local code is the latest version, which is the same as the server code. There is no error message in the test environment log. You can manually call this stored procedure in plsql to generate the code normally. The bug has been detected for four days, but no reason can be found. Finally, the system was about to be released to the site, so the team lead could not be taken back. At a time when there were no preparations, a Technical Architecture engineer said that the configuration group had changed the oracle driver. We tested the speed and changed the oracle Driver program from * Oracle's Driver (Thin) Versions: 9.0.1, 9.2.0, to * Oracle's Driver (Thin XA) Versions: 9.0.1, 9.2.0, 11, restart the local environment, verify, and reproduce the problem. This is indeed the cause.

Cause: When an XA database driver is used, the commit keyword cannot be used in the script. When the commit keyword is used in the stored procedure, the execution of the stored procedure fails. Replace the oracle driver in the test environment with the one without XA and verify the problem again.

XA description extracted from the following (http://www.infoq.com/cn/articles/xa-transactions-handle ):

Use XA For Databases

You can use the database driver of the XA version to make the database support XA. Because the database drivers of the XA version are usually much more difficult to use than those of the non-XA version, one piece of advice is that you should not use the XA driver unless you have.

The use of the XA database driver often leads to unexpected and difficult-to-solve errors. For example, replacing a non-XA driver with an XA driver often produces errors that are difficult to track. Therefore, XA drivers should be introduced as early as possible in the project development and testing phases (to expose and solve problems as soon as possible ).

When using the XA database driver, you may encounter local transaction errors and nested transaction errors. When you try to start a new transaction while an XA global transaction is in progress, these errors will occur. This situation may occur in multiple environments, but the most common situation is the mixed local transaction model and declarative transaction model, and the use of stored procedures in the XA environment.

When a stored procedure is used in the XA environment, calling DDL (data definition statements, such as create table, begin tran, end tran) in the stored procedure often leads to errors. This is the culprit of the most frequent XA errors and is difficult to fix. For example, when you use XA in Oracle, you may see the following error message:

ORA-02089: COMMIT is not allowed in a subordinate session

If you use a non-XA database driver, you probably won't see this error, because the JTA transaction is paused when the DDL statement is executed. When this error message is displayed, it indicates that your Stored Procedure contains the DDL code and the local transaction (managed by the Resource Manager) Attempts to commit its work.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.