作者:网络 来源:佚名 更新时间:2008-07-07 11:43:08 点击:
    1. jbuilder正确连接 oracle 9i需要注意的几个问题
    2. oracle8以上的应该都使用classes12.jar文件作为jdbc驱动;
    • 正确设置windows的classpath和jbuilder中的enterprise setup 、configure libraries,将casses12.jar路径正确添加到上述需要设置的地方;
    • 进入database pilot,在database pilot中,file---new 在driver列表中如果oracle的驱动是红色的,就说明你的oralce在jb中加载失败;
    • 若③没有错,则新建一个url:jdbc:oracle:thin:@(yourhostname):1521:(your sid)
    • 连接数据库的username/password
    1. 注:大部分站友的jbuilder连接oracle的问题都是由于没有正确配置classpath等引起的。
    2. 使用非xa方式连接oracle数据库


      #oracle 10
      oracle_xa;xaosw;%oracle_home% dbms oraxa10.lib%oracle_home%precompibmsvcorasql10.lib

      #oracle 9
      oracle_xa;xaosw;%oracle_home% dbms oraxa9.lib%oracle_home%precompibmsvcorasql9.lib


      第一:在windows 下 oracle_xa 和xaosw后面的是分号";",不是冒号":"

    3. jdbc操作oracle数据库时出现‘java.sql.sqlexception:io异常,不在流模式下’
    4. 用oraclestatment,,不要用java.sql.statment
    5. 如果对已有连接进行setautocommit失败,则关闭该连接并重新建立一个连接
    6. 到oracle站点下载一个最新的jdbc driver,如果操作lob类型,用oracle自带的接口和类
    7. weblogic连接oracle问题:the network adapter could not establish the connection


    8. weblogic中使用oracle连接池及oracle备份的注意事项

      使用hp-unix,weblogic 8.1,oracle
      配置了一个普通的连接池,驱动程序采用oracle的oracle’s driver(thin) version 9.0.1, 9.2.0



      应该是oracle9的exp bug导致连接池问题,不要使用exp倒出同义词

    9. 连接oracle时抛出如下异常:java.sql.sqlexception: io exception:the network adapter could not establish connection一种产生原因

      oracle database connection (from oracle.com)
      you are attempting to connect to an 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) you are able to establish a sql*plus connection from the same
         client to the same oracle instance.
      2) you 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 an ip address.
      to verify whether you are hitting this problem, verify whether the oracle instance is configured for multithreaded server (mts). if the oracle instance is not 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 be accomplished in several ways. for jdbc oci or thin, this can be done by reconfiguring the server for dedicated connections only. this approach, however, may not be 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 must specify a full name-value pair connect string (the same as it might appear in the tnsnames.ora file) instead of the short jdbc thin syntax. for example, instead of
      you 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 having made these changes, it is very likely that this is the problem you are encountering. in this case, one last test will help to verify this fact.
      log into the remote host on which the oracle instance is running and execute the appropriate command to determine what the server 'thinks' its hostname is (i.e. the name that was configured when the server was installed and configured). for example, on a unix host the 'hostname' command can be 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 command had the domain name included, then include it), return to the client which was unable to connect and try pinging the server.
      note: it is critical that you attempt to ping the server using exactly the same hostname you got from the server.
      if you are unable to ping the server via this hostname, then you almost certainly hitting this problem. if not, this may be a new issue, but at least you will have found a workaround (i.e. use a dedicated connection).
      to understand why this problem occurs, one must first understand the differences in how the listener handles connections to 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 this case. when connecting to a shared server, the initial client connection to the listener is the same. however, with mts, there is 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 client 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 will always specify a hostname, even if the client initially provided an ip address.
      if, for any reason, the hostname provided to the listener (e.g. by the 'hostname' or another command) doesn't agree with the hostname by which the server is known on the client, the connection fails.
      on the other hand, if "(server=dedicated)" already appears in the tns connect string in tnsnames.ora or if "use_dedicated_server=on" already appears in the sqlnet.ora file, you may find that sql*plus and/or jdbc oci work fine, while jdbc thin fails.
      obviously, one solution is to use dedicated servers. however, this may not always be feasible.
      the key is to make sure the hostname on both the client and server agree. this can be accomplished by reconfiguring either the client or the server, but there are things to be aware of in both cases.
      if the server is configured to return a different hostname, then it is possible that other clients which used to work will now fail.
      in some cases, it may not be feasible to reconfigure the client. for example, if the server version of the hostname does not include the domain, you would need to remove the domain portion of the hostname on the client; but, if the client needs to connect to more than one server with the same base name in different domains, this may not be possible, as the hostname may be ambiguous.
      bug:1269734 java.sql.sqlexception: io exception: the network adapter could not be found.

    1. 连接oracle数据库报错:javax.naming.namenotfoundexception: unable to resolve oracthin. resolved: '' unresolved:'oracthin' ; remaining name '' 
    2. 问题描述:配置完jdbc后,打开页面的时候,报出如下错误信息:
      javax.naming.namenotfoundexception: unable to resolve oracthin. resolved: '' unresolved:'oracthin' ; remaining name ''
      connection pools(连接池)
      driver classname:oracle.jdbc.driver.oracledriver
      jndi name:oracthin
      pool name:oracthin
      ctx = new initialcontext();
      ds = (javax.sql.datasource)ctx.lookup ("oracthin"); 
    3. 问题解决后汉字是乱码 
    4. 错误产生原因及解决办法:
    5. url:jdbc:oracle:thin:.0.0.1:1521:lysimi,thin后面加:,后面加端口号
    • 注意名字大小写.
    • target 到server上
    • 再看看pool是否起来了,没起来的话,重起weblogic
    • 乱码问题(java是基于unicode):
      • 在jsp 文件中加入<%@ page contenttype="text/html; charset=gbk" %>
      • 在weblogic.xml文件的<jsp-descriptor>部分加入
    1. oracle xa的疑惑

      问题描述:oracle_xa;xaosw;d:oracleora92 dbmsxaoraxa9.lib c:msvcorasql9.lib中



    2. oracle与weblogic自动启动与停止

      问题描述:每次重新启动服务器时oracle数据库若没有关闭,则必须先关闭后在重新启动redhat advance server,oracle才能够正常运行