|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
其实你不用Struts,spring这些工具,直接用jsp,servlet能够很方便地写出来,而且,可以根据个人的水平、爱好,有很多方案。而struts,spring这些工具的出来。oracle|办理|数据|数据库|成绩
- Jbuilder准确毗连oracle9i必要注重的几个成绩
- oracle8以上的应当都利用classes12.jar文件作为jdbc驱动;
- 准确设置windows的classpath和jbuilder中的enterprisesetup、configurelibraries,将casses12.jar路径准确增加到上述必要设置的中央;
- 进进databasepilot,在databasepilot中,file---new在driver列表中假如oracle的驱动是白色的,就申明你的oralce在jb中加载失利;
- 若③没有错,则新建一个url:jdbc:oracle:thin:@(yourhostname):1521:(yoursid)
- 毗连数据库的Username/password
- 注:年夜部分站友的jbuilder毗连oracle的成绩都是因为没有准确设置classpath等引发的。
- 利用非XA体例毗连ORACLE数据库在windows下设置Oracle_XA时要注重两点:
#ORACLE10
Oracle_XA;xaosw;%ORACLE_HOME%dbmsoraxa10.lib%ORACLE_HOME%precompibmsvcorasql10.lib
#oracle9
Oracle_XA;xaosw;%ORACLE_HOME%dbmsoraxa9.lib%ORACLE_HOME%precompibmsvcorasql9.lib
Unix下
Oracle_XA:xaosw:....
第一:在windows下ORACLE_XA和xaosw前面的是分号";",不是冒号":"
第二:下面的这些LIB写在一行上,两头用空格分隔,假如没有在体系的情况变量中设置ORACLE_HOME,就写相对路径。
- JDBC操纵ORACLE数据库时呈现‘java.sql.SQLException:IO非常,不在流形式下’
- 用OracleStatment,,不要用java.sql.Statment
- 假如对已有毗连举行setAutoCommit失利,则封闭该毗连偏重新创建一个毗连
- 到ORACLE站点下载一个最新的JDBCDriver,假如操纵LOB范例,用ORACLE自带的接口和类
- weblogic毗连oracle成绩:TheNetworkAdaptercouldnotestablishtheconnection
多是服务器的监听停失落了,是数据库的成绩,与使用有关;应当先反省一下oracle是不是一般,用sql*plus毗连一下数据库,看可否一般毗连;
- Weblogic中利用Oracle毗连池及Oracle备份的注重事项利用HP-UNIX,Weblogic8.1,Oracle9.2.0.5
设置了一个一般的毗连池,驱动程序接纳oracle的Oracle’sDriver(Thin)version9.0.1,9.2.0
毛病情形:
了局利用数据库毗连池时报错,说没有毗连池资本了。实践上数据库的毗连池完整余暇,而且测试也是对的,Oracle也是一般能够毗连、利用的。
成绩本源:
经由过程层层排错,发明本来背景在利用Oracle的exp备份一个只要同义词的用户,招致exp历程僵逝世。
杀逝世exp、重启Oracle等没法办理成绩,终极重启UNIX,克制备份只要同义词的用户,成绩办理。
总结:
应当是Oracle9的expBUG招致毗连池成绩,不要利用exp倒出同义词
- 毗连Oracle时抛出以下非常:java.sql.SQLException:Ioexception:TheNetworkAdaptercouldnotestablishconnection一种发生缘故原由OracleDatabaseConnection(fromoracle.com)
PROBLEM
YouareattemptingtoconnecttoanOracleinstanceusingJDBCandyouarereceivingthefollowingerror.
java.sql.SQLException:Ioexception:
TheNetworkAdaptercouldnotestablishconnection
SQLException:SQLState(null)vendorcode(17002)
Anyorallofthefollowingconditionsmayalsoapply:
1)YouareabletoestablishaSQL*Plusconnectionfromthesame
clienttothesameOracleinstance.
2)YouareabletoestablishaJDBCOCIconnection,butnotaThin
connectionfromthesameclienttothesameOracleinstance.
3)ThesameJDBCapplicationisabletoconnectfromadifferent
clienttothesameOracleinstance.
4)ThesamebehaviorapplieswhethertheinitialJDBCconnection
stringspecifiesahostnameoranIPaddress.
REDISCOVERY
Toverifywhetheryouarehittingthisproblem,verifywhethertheOracleinstanceisconfiguredforMultithreadedServer(MTS).IftheOracleinstanceisnotconfiguredforMTS,youareprobablyencounteringadifferentproblem.Otherwise,continue.TryforcingtheJDBCconnectiontouseadedicatedserverinsteadofasharedserver.Thiscanbeaccomplishedinseveralways.ForJDBCOCIorThin,thiscanbedonebyreconfiguringtheserverfordedicatedconnectionsonly.Thisapproach,however,maynotbefeasibleinmanycases.Insuchcases,thefollowingoptionsapply:ForJDBCOCI:
1)Addthe(SERVER=DEDICATED)propertytotheTNSconnectstring
storedinthetnsnames.orafileontheclient.
2)Settheuser_dedicated_server=ONinsqlnet.oraontheclient.
ForJDBCThin:
Youmustspecifyafullname-valuepairconnectstring(thesameasitmightappearinthetnsnames.orafile)insteadoftheshortJDBCThinsyntax.Forexample,insteadof
"jdbc:oracle:thin::port:sid"
youwouldneedtouseastringoftheform
"jdbc:oracle:thin:@(DESCRIPTION="+
"(ADDRESS_LIST="+
"(ADDRESS=(PROTOCOL=TCP)"+
"(HOST=host)"+=
"(PORT=port)"+
")"+
")"+
"(CONNECT_DATA="+
"(SERVICE_NAME=sid)"+
"(SERVER=DEDICATED)"+
")"+
")"
Iftheconnectionworksfineafterhavingmadethesechanges,itisverylikelythatthisistheproblemyouareencountering.Inthiscase,onelasttestwillhelptoverifythisfact.
LogintotheremotehostonwhichtheOracleinstanceisrunningandexecutetheappropriatecommandtodeterminewhattheserverthinksitshostnameis(i.e.thenamethatwasconfiguredwhentheserverwasinstalledandconfigured).Forexample,onaUnixhostthehostnamecommandcanbeusedforthispurpose.
Usingthenamedisplayed(e.g.bythehostnamecommand),exactlyasitappeared(i.e.iftheoutputfromthehostnamecommandhadthedomainnameincluded,thenincludeit),returntotheclientwhichwasunabletoconnectandtrypingingtheserver.
NOTE:ItiscriticalthatyouattempttopingtheserverusingEXACTLYthesamehostnameyougotfromtheserver.
Ifyouareunabletopingtheserverviathishostname,thenyoualmostcertainlyhittingthisproblem.Ifnot,thismaybeanewissue,butatleastyouwillhavefoundaworkaround(i.e.useadedicatedconnection).
EXPLANATION
Tounderstandwhythisproblemoccurs,onemustfirstunderstandthedifferencesinhowthelistenerhandlesconnectionstosharedserversversusdedicatedservers.
Whenconnectingtoadedicatedserver,theclientconnectstothelistener(viahostnameorIPaddress).Thelistenerthenspawnsadedicatedserverprocessandhandsoffthesocketusedtoaccepttheclientconnectiontothatserver.Theclientandserverthenstartcommunicatingviatheendpointsestablishedbytheinitialconnection.NOTE:Thereisonlyoneconnectioninthiscase.Whenconnectingtoasharedserver,theinitialclientconnectiontothelisteneristhesame.However,withMTS,thereisnoneedtospawnanewserverprocess;apoolofsharedprocessesalreadyexists.Also,clientsdonotcommunicatedirectlywiththeserverprocessesinMTS;rather,theycommunicatewithadispatcher.
Forthisreason,whensettingupanMTSconnection,thelistenersendsaredirectmessagebacktotheclientaskingtheclienttoclosetheconnectiontothelistenerandconnecttoadispatcher.Theinformationinthismessageincludesthehostnameandaportnumberfortheappropriatedispatcher.TheredirectmessagewillALWAYSspecifyahostname,eveniftheclientinitiallyprovidedanIPaddress.
If,foranyreason,thehostnameprovidedtothelistener(e.g.bythehostnameoranothercommand)doesntagreewiththehostnamebywhichtheserverisknownontheclient,theconnectionfails.
Ontheotherhand,if"(SERVER=DEDICATED)"alreadyappearsintheTNSconnectstringintnsnames.oraorif"use_dedicated_server=ON"alreadyappearsinthesqlnet.orafile,youmayfindthatSQL*Plusand/orJDBCOCIworkfine,whileJDBCThinfails.
SOLUTION
Obviously,onesolutionistousededicatedservers.However,thismaynotalwaysbefeasible.
Thekeyistomakesurethehostnameonboththeclientandserveragree.Thiscanbeaccomplishedbyreconfiguringeithertheclientortheserver,buttherearethingstobeawareofinbothcases.
Iftheserverisconfiguredtoreturnadifferenthostname,thenitispossiblethatotherclientswhichusedtoworkwillnowfail.
Insomecases,itmaynotbefeasibletoreconfiguretheclient.Forexample,iftheserverversionofthehostnamedoesnotincludethedomain,youwouldneedtoremovethedomainportionofthehostnameontheclient;but,iftheclientneedstoconnecttomorethanoneserverwiththesamebasenameindifferentdomains,thismaynotbepossible,asthehostnamemaybeambiguous.
REFERENCES
bug:1269734java.sql.SQLException:Ioexception:TheNetworkAdaptercouldnotbefound.
- 毗连ORACLE数据库报错:javax.naming.NameNotFoundException:UnabletoresolveoracThin.Resolved:Unresolved:oracThin;remainingname
- 成绩形貌:设置完JDBC后,翻开页面的时分,报出以下毛病信息:
javax.naming.NameNotFoundException:UnabletoresolveoracThin.Resolved:Unresolved:oracThin;remainingname
JDBC设置以下:
ConnectionPools(毗连池)
Name:OracThin
URL:jdbc:oracle:thin.0.0.1:LYSIMIS
DriverClassname:oracle.jdbc.driver.OracleDriver
Properties:
user=system
password=manager
dll=ocijdbc8
protocol=thin
数据源设置以下:
Name:OracThin
JNDIName:OracThin
PoolName:OracThin
当程序实行到这一步时堕落。
ctx=newInitialContext();
ds=(javax.sql.DataSource)ctx.lookup("OracThin");
- 成绩办理后汉字是乱码
- 毛病发生缘故原由及办理举措:
- URL:jdbc:oracle:thin:.0.0.1:1521:LYSIMI,thin前面加:,127.0.0.1前面加端标语
- 注重名字巨细写.
- target到server上
- 再看看pool是不是起来了,没起来的话,重起weblogic
- 乱码成绩(Java是基于Unicode):
- 在JSP文件中到场<%@pagecontentType="text/html;charset=GBK"%>
- 在weblogic.xml文件的<jsp-descriptor>部分到场
<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>
- oracleXA的困惑
成绩形貌:Oracle_XA;xaosw;D:oracleora92dbmsXAORAXA9.libC:msvcoraSQL9.lib中
xaosw是甚么意义
解答:能够参考ORACLE的XA部分的文档。
http://www-rohan.sdsu.edu/doc/oracle/server803/A54642_01/ch_xa.htm
- oracle与weblogic主动启动与中断成绩形貌:每次从头启动服务器时oracle数据库若没有封闭,则必需先封闭后在从头启动redhatadvanceserver,oracle才干够一般运转
缘故原由及办理举措拜见:
http://dev2dev.bea.com.cn/bbs/thread.jspa?forumID=81&threadID=8839&messageID=43184#43184
其实产生见解的过程就是训练自己发现问题,分析问题的能力。根据以上的认识我想谈下传统的学习与通过视频独立学习的优缺点: |
|