JDBC Connection Oracle Database common problems and solutions _jsp programming

Source: Internet
Author: User
Tags connection pooling dedicated server

Note: This article is the owner from the JDBC & transaction version of the vast number of friends to extract the questions and solutions, if you think the content of this article has offended your interests, please contact the administrator to make changes.

  1. JBuilder several issues to be aware of when connecting Oracle 9i correctly
    • Oracle8 above should all use the Classes12.jar file as JDBC driver;
    • Correctly set up the enterprise Setup, configure libraries in Windows Classpath and JBuilder, and add the Casses12.jar path to the place where you need to set up.
    • Enter the database pilot, in the database pilot, file---New in the driver list if the Oracle driver is red, it means that your oralce failed to load in JB;
    • If ③ is not wrong, create a new url:jdbc:oracle:thin:@ (Yourhostname): 1521: (Your SID )
    • Username/password to connect to a database

    Note: Most of the JBuilder connections to Oracle are caused by improper configuration of classpath.

  2. Connecting Oracle databases with non-XA methods

    Be aware of two points when configuring Oracle_xa under Windows:

    #ORACLE 10
    Oracle_xa;xaosw;%o Racle_home% DBMS Oraxa10.lib%oracle_home%precompibmsvcorasql10.lib

    #oracle 9
    Oracle_xa;xaosw;%o Racle_home% DBMS Oraxa9.lib%oracle_home%precompibmsvcorasql9.lib

    Under Unix
    ORACLE_XA:XAOSW: .....

    First: After Windows Oracle_xa and XAOSW are semicolon ";", not colon ":"
    Second: The above Lib write on a line, the middle with a space apart, if not in the system environment variable set oracle_home, write absolute path.

  3. ' Java.sql.SQLException:IO exception, not in streaming mode ' when JDBC operates Oracle database
    1. With Oraclestatment, don't use java.sql.Statment.
    2. If Setautocommit fails for an existing connection, close the connection and re-establish a connection
    3. Download the latest JDBC Driver to the Oracle site, and if you operate the LOB type, Oracle-brought interfaces and classes
  4. WebLogic Connection Oracle Problem: The network Adapter could not establish the connection

    May be the server's listening to stop, is the problem of the database, and the application is irrelevant; should first check whether Oracle is normal, with Sql*plus connection database, see whether normal connection;

  5. Considerations for using Oracle connection pooling and Oracle backups in WebLogic

    Using Hp-unix,weblogic 8.1,oracle 9.2.0.5
    Configured with a common connection pool, the driver uses Oracle's Oracle ' s Driver (Thin) version 9.0.1, 9.2.0

    Error condition:
    Results using database connection pool The times are wrong and say there is no connection pool resource. In fact, the database connection pool is completely idle, and the test is also true, Oracle is also normal to connect, use.

    Problem Root:
    Through the layers of error, found that the original backend in the use of Oracle's exp backup a only synonym users, resulting in the exp process zombie.
    Unable to resolve the problem by killing Exp, restarting Oracle, and eventually restarting Unix, it is forbidden to back up only synonyms for users, problem solving.

    Summarize:
    should be ORACLE9 exp bug causes connection pooling problem, do not use exp to pour out synonyms

  6. The following exception was thrown when connecting to Oracle: Java.sql.SQLException:Io exception:the Network Adapter could not establish connection a cause

    Oracle Database Connection (from oracle.com)
    PROBLEM
    You are are attempting to connect to a Oracle instance using JDBC and you are receiving the following error.
    Java.sql.SQLException:Io Exception:
    The network Adapter could not establish connection
    Sqlexception:sqlstate (NULL) Vendor code (17002)
    Any or all of the following conditions may also apply:
    1 are able to establish a sql*plus connection from the same
    Client to the same Oracle instance.
    2 are able to establish a JDBC OCI connection, but not a Thin
    Connection from the same client to the same Oracle instance.
    3) The same JDBC application is able to connect from a different
    Client to the same Oracle instance.
    4) The same behavior applies whether the initial JDBC connection
    string specifies a hostname or a IP address.
    Rediscovery
    To verify whether your are hitting this problem, verify whether the Oracle instance was configured for multithreaded Server (MTS). If The Oracle instance is isn't configured for MTS, you are probably encountering a different problem. Otherwise, continue. Try forcing the JDBC connection to use a dedicated server instead of a shared server. This can is accomplished in several ways. For JDBC OCI or Thin, this can do by reconfiguring to dedicated connections only. This is approach, however, May is feasible in many cases. In such cases, the following options apply:for JDBC OCI:
    1) Add the (server=dedicated) property to the TNS connect string
    stored in the Tnsnames.ora file on the client.
    2) Set the User_dedicated_server=on in Sqlnet.ora on the client.
    For JDBC Thin:
    You are must specify a full name-value pair connect string (the same as it might appear in the Tnsnames.ora file) instead of T He-short JDBC Thin syntax. For example, instead of
    "Jdbc:oracle:thin::p ort:sid"
    You are would need to use a string of the form
    "jdbc:oracle:thin:@ (description=) +
    "(address_list=) +
    "(Address= (protocol=tcp)" +
    "(host=host)" + =
    "(port=port)" +
    ")"                       +
    ")"                           +
    "(connect_data=) +
    "(SERVICE_NAME=SID)" +
    "(server=dedicated)" +
    ")"                           +
    ")"
    If The connection works fine after have made these are changes, it is very likely "this is" problem you are Ing. In this case, one of the last Test would help to verify this fact.
    Log into the remote host on which the Oracle instance are running and execute the appropriate command to determine what the The server ' thinks ' its hostname is (i.e. the name of this was configured when the server was installed and configured). For example, on a Unix host the ' hostname ' command can is used for this purpose.
    Using the name displayed (e.g. by the hostname command), exactly as it appeared (i.e. if the output from the hostname comm and had the domain name included, then include it), return to the client which is unable to connect and try pinging the S Erver.
    Note:it is critical this you attempt to ping the server using exactly the same hostname you got from the server.
    If you are are unable to ping the server via this hostname, then your almost certainly this hitting. If not, the May is a new issue, but at least your would have found a workaround (i.e. use a dedicated connection).
    Explanation
    To understand why this problem occurs, one must the "understand" in "how" differences listener, handles T o Shared servers versus dedicated servers.
    When connecting to a dedicated server, the client connects to the listener (via hostname or IP address). The listener then spawns a dedicated server process and hands off the socket used to accept the client connection to that Server. The client and server then start communicating via the endpoints established by the initial connection. Note:there is only one connection in the case. When connecting to a shared server, the initial client connection to the listener is the same. However, with MTS, there are no need to spawn a new server process; A pool of shared processes already exists. Also, clients do not communicate directly with the server processes in MTS; Rather, they communicate with a dispatcher.
    For this reason, when setting up an MTS connection, the listener sends a redirect message back to the client asking the CL Ient to close the connection to the listener and connect to a dispatcher. The information in this message includes the hostname and a port number for the appropriate dispatcher. The redirect message would ALWAYS specify a hostname, even if the client initially a IP address.
    If, for all reason, the hostname provided to the listener (e.g. by the ' hostname ' or another command) doesn ' t agree and T He hostname by which the "server is" known on the client, the connection fails.
    On the other hand, if "(server=dedicated)" already appears into the TNS connect string in Tnsnames.ora or if "use_dedicated_ Server=on "already appears in the Sqlnet.ora file, and you could find this sql*plus and/or JDBC OCI work fine, while JDBC Thin f Ails.
    SOLUTION
    Obviously, one solution is to use dedicated servers. However, this may isn't always be feasible.
    The "key is" to "sure" hostname on both the client and server agree. This can is accomplished by reconfiguring either the client or the server but there are things to is aware of in both CAs Es.
    If the server is configured to return a different hostname, then it is possible this other clients which used to work would Now fail.
    In some cases, it may is feasible to reconfigure the client. For example, if the server version of the hostname does isn't include the domain, you would need to remove the domain Portio N of the hostname on the client; But, if the client needs to connect to the than one server with the same base name in different domains Possible, as the hostname may ambiguous.
    REFERENCES
    bug:1269734 java.sql.SQLException:Io exception:the Network Adapter could not be found.

  7. Connect Oracle Database error: javax.naming.NameNotFoundException:Unable to resolve Oracthin. Resolved: ' Unresolved: ' Oracthin '; Remaining name "" 

    Problem Description: When you have finished configuring JDBC, when you open the page, the following error message is reported:
    Javax.naming.NameNotFoundException:Unable to resolve Oracthin. Resolved: ' Unresolved: ' Oracthin '; Remaining name ""
    The JDBC configuration is as follows:
    Connection pools (Connection pool)
    Name:oracthin
    Url:jdbc:oracle:thin.0.0.1:lysimis
    Driver Classname:oracle.jdbc.driver.OracleDriver
    Properties:
    User=system
    Password=manager
    Dll=ocijdbc8
    Protocol=thin
    The data source is configured as follows:
    Name:oracthin
    JNDI Name:oracthin
    Pool Name:oracthin
    An error occurred while the program was executing to this step.
    CTX = new InitialContext ();
    ds = (Javax.sql.DataSource) ctx.lookup ("Oracthin");  

    The characters are garbled after the problem is solved

    Error Causes and solutions:

      • Url:jdbc:oracle:thin:.0.0.1:1521:lysimi,thin behind add:, 127.0.0.1 after the port number
      • Note the name case.
      • Target to Server
      • Let's see if the pool is up or not, WebLogic.
      • Garbled problem (Java is based on Unicode):
        • Add <%@ page contenttype= to the JSP file text/html; CHARSET=GBK "%>
        • Add in the <jsp-descriptor> section of the Weblogic.xml file
          <jsp-descriptor>
          <jsp-param>
          <param-name>compilerSupportsEncoding</param-name>
          <param-value>true</param-value>
          </jsp-param>
          <jsp-param>
          <param-name>encoding</param-name>
          <param-value>GBK</param-value>
          </jsp-param>
          </jsp-descriptor>
  8. Oracle XA's puzzle

    Problem Description: Oracle_xa;xaosw;d:oracleora92 dbmsXAORAXA9.lib c:msvcorasql9.lib
    What do you mean, XAOSW?

    Answer: You can refer to the documentation for the XA section of Oracle.

    Http://www-rohan.sdsu.edu/doc/oracle/server803/A54642_01/ch_xa.htm

  9. Oracle and WebLogic automatic start and stop

    Problem Description: If the Oracle database is not closed each time the server is restarted, it must be shut down before restarting Redhat advance server,oracle to function properly

    Reasons and solutions See:

    http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=81&threadID=8839&messageID=43184#43184

This article is just a small part of the article, if there is no answer to your question, please consult the essence of this edition, you can also use the Forum search function.

Finishing Date 2005.9.26

-->
Author Introduction
Dev2dev id:lhbing, Dev2dev forum Moderator, WEBLOIGC and Java technology enthusiasts

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.