Tomcat与Oracle安装配置方法.docx
《Tomcat与Oracle安装配置方法.docx》由会员分享,可在线阅读,更多相关《Tomcat与Oracle安装配置方法.docx(21页珍藏版)》请在冰点文库上搜索。
Tomcat与Oracle安装配置方法
InstallationInstructionsfor:
Tomcat6.0or7.0
Oracle10g(ExpressEditionXE)
Tomcat7.0Installation
1.DownloadApacheTomcat7andunzipit.
2.AddthelocationofyourJDKorJREtotheenvironmentvariable$JAVA_HOMEor$JRE_HOME
3.AddthelocationofyourTomcattotheenvironmentvariable$CATALINA_HOME
4.Add$CATALINA_HOME/bintoyourenvironmentvariable$PATH
5.Changeeveryoccurrenceofport8080to8088in$CATALINA_HOME/conf/server.xml
6.Edit$CATALINA_HOME/conf/tomcat-users.xmlandaddamanger:
7.TostartTomcatopenacommandwindowandtypestartup
8.TostopTomcatopenacommandwindowandtypeshutdown
9.TooperateTomcatgotoStep6inthenextsection.
Tomcat6.0Installation
1. DownloadApacheTomcatInstallerandrunit.
2. SelectFullinstallationoption
3. ToavoidpossibleconflictswithOraclechooseConnectorPort8088;selectanyusernameandpasswordyouwish.
4. TostartTomcat,gotoAllPrograms>ApacheTomcat6.0>ConfigureTomcatmenuitemandclickStart
5. TostopTomcat,gotoAllPrograms>ApacheTomcat6.0>ConfigureTomcatmenuitemandclickStop
6. Toconnecttothemanager,gotoAllPrograms>ApacheTomcat6.0>TomcatManagerandentertheusernameandpasswordyouselectedinStep3
7. Youshouldthenseethemanageropenupinyourwebbrowser(http:
//localhost:
8088/manager/html)asshownbelow.MakesureMessageisOK.
8. UnzipandcopytheentiremyJSPdirectory,whichcontainsanumberofJSPexamples,towebappsdirectoryunderyourTomcat6.0homedirectory.Todeploythisdirectory,type/myJSPinContextPathasshownbelowandclicktheDeploybutton.
9. TotesttheJSPexamplescontainedinthemyJSPdirectory,typetheirexactaddressinyourbrowser’sURLboxasshownbelow:
10. Finally,toenableTomcattoconnecttoOraclecopytheOracleJDBCdrivertothelibdirectoryunderyourTomcat’shomedirectory.
Oracle10g(ExpressEditionXE)Installation
∙DownloadandinstallOracle10gforWindowsXP.
∙Duringinstallationyouwillbepromptedtoenterapassword.ThatpasswordalongwiththeusernamesystemwillallowyoutologintoOracleastheSystemAdministratortocreateuseraccounts.
∙OnceOracleisinstalled,itwillberunninglocallyonyourPCoffport8080andyouwillbeabletoaccessitthroughOracle’sApplicationExpress(apex)interface.
CreatingDatabaseUserAccounts
LoginasSystemAdministratortocreateuseraccounts:
GotoAdministration-DatabaseUsersandselectCreate:
Enteryourchoiceofusernameandpasswordandmakesureallcheckboxesarechecked(exceptforDBA):
Now,logoutandlogbackinasthenewusertorunSQLcommands.
RunningSQLCommands
Loginasthedatabaseusercreatedinthepreviousstep:
SelecttheSQLoptions:
SelecttheSQLCommandsoptions:
NowenterSQLcommandsinthetoppanelandthenclickRunorSaveorHistory:
PopulatingTableswithData
Assumewehaverelationtempstoredinthedatabaseasshownabove.Datacanbeenteredonerowatatimeusingtheinsertintocommand:
Whenworkingwithlargeamountsofdatathatarestoredinexternalfiles,youmayimporttheexternaldatabycreatingatab-separateddatafileusingatexteditorsuchasNotepadorTextpad.Let’sassumewehaveatab-separatedtextfilecalledtemp.datasshownbelow:
GotoHome>Utilities>DataLoad/Unload>Load>LoadTextDataandselectExistingTableandUploadFileoptionsasshownbelow.Then,clickNexttwice:
SelectTemp(table)andNext:
ChooseFiletemp.dat,type\t(tab)intheSeparatorboxanduncheckthecheckbox.Then,clickNext:
SelectappropriateColumnNamesandnoticethereadrowsofdataatthebottomoftheColumnMappingsection:
Theresultscreenshouldshow2(rowsofdata)forSucceeded0forFailed.Anon-zerovalueforFailedwillmeanthatyouhaveskippedsomeofthestepsaboveoryourinputfileisnotinthecorrectformat:
Toverifythedataload,gotoHome>SQL>SQLCommandsandexaminethecontentsoftemp:
CreatingandRunningSQLScripts
GotoHome-SQLandchoosetheSQLScriptsoptions:
YoumaycreatescriptsinternallythroughOracle’sScriptEditororexternallythroughNotepadoranothertexteditor.CreateaSQLscriptfilecalledquery1.sql:
createtablechefs
(
CHEF_ID intnotnull,
NAME varchar2(20),
SPECIALTY varchar2(20),
SALARY number(10),
primarykey(CHEF_ID)
);
Uploadthescriptandgiveitaname:
Ifallgoeswell,thescriptwillappearasanicononthebottompanel:
ChangetheViewoptiontoDetailsandclickGoandyoushouldseethefollowingscreenappear.NowclickRun:
ConfirmyourrequestbyclickingRunagainandthenViewResults:
Afterviewingtheresults,gobacktoHome-SQL-SQLCommandstoexaminethecatalogandmakesurethechangeshavetakenplace:
RunningSQLCommandLineUtility
∙InadditiontousingOracle’sgraphicaluserinterface,youmayusetheRunSQLCommandLineutilitytorunSQLcommandsorload/executeSQLscripts.Onyourdesktopclick:
Start–Oracle10gExpressEdition–RunSQLCommandLine
∙WhentheSQL>promptappears,loginastheDBuser.Forexample,ifyouhavesetupauserbforourawithpasswordbforoura,enter:
SQL>connectbforoura
Enterpassword:
bforoura
∙Whenyouareloggedin,youmaytypeinSQLcommandsorloadSQLscripts(seemyOraclelecturenotes)
∙Tocreateanoutputofyoursession,usethespoolcommand
SQL>spoolc:
\temp\output.txt --savetheoutputfileintherequiredlocation
SQL>typeinallyourcommandshere
SQL>…
SQL>spooloff --nowallyoursessiontransactionsaresavedinthisfile
ConnectingtoOracle10gviaTomcat6.0
1.LogintoOracleasaregularuserandcreatetheemployeesrelationandfillitwithdataasshownhere.
2.StartTomcatandgotohttp:
//localhost:
8088/myJSP/ex5.html.TypeintheusernameandpasswordoftheOracleuseryoupreviouslycreated.
3.Youshouldseethetabledataappearonthewebpageasshownbelow:
4.WE’REDONE!