java JDBC 外文翻译 外文文献 英文文献.docx

上传人:b****2 文档编号:2461245 上传时间:2022-10-29 格式:DOCX 页数:20 大小:44.46KB
下载 相关 举报
java JDBC 外文翻译 外文文献 英文文献.docx_第1页
第1页 / 共20页
java JDBC 外文翻译 外文文献 英文文献.docx_第2页
第2页 / 共20页
java JDBC 外文翻译 外文文献 英文文献.docx_第3页
第3页 / 共20页
java JDBC 外文翻译 外文文献 英文文献.docx_第4页
第4页 / 共20页
java JDBC 外文翻译 外文文献 英文文献.docx_第5页
第5页 / 共20页
点击查看更多>>
下载资源
资源描述

java JDBC 外文翻译 外文文献 英文文献.docx

《java JDBC 外文翻译 外文文献 英文文献.docx》由会员分享,可在线阅读,更多相关《java JDBC 外文翻译 外文文献 英文文献.docx(20页珍藏版)》请在冰豆网上搜索。

java JDBC 外文翻译 外文文献 英文文献.docx

javaJDBC外文翻译外文文献英文文献

原文一:

JavaProgrammingwithOracleJDBC:

Performance

Performanceisusuallyconsideredanissueattheendofadevelopmentcyclewhenitshouldreallybeconsideredfromthestart.Often,ataskcalled"performancetuning"isdoneafterthecodingiscomplete,andtheenduserofaprogramcomplainsabouthowlongittakestheprogramtocompleteaparticulartask.Thenetresultofwaitinguntiltheendofthedevelopmentcycletoconsiderperformanceincludestheexpenseoftheadditionaltimerequiredtorecodeaprogramtoimproveitsperformance.It'smyopinionthatperformanceissomethingthatisbestconsideredatthestartofaproject.

WhenitcomestoperformanceissuesconcerningJDBCprogrammingtherearetwomajorfactorstoconsider.ThefirstistheperformanceofthedatabasestructureandtheSQLstatementsusedagainstit.ThesecondistherelativeefficiencyofthedifferentwaysyoucanusetheJDBCinterfacestomanipulateadatabase.

Intermsofthedatabase'sefficiency,youcanusetheEXPLAINPLANfacilitytoexplainhowthedatabase'soptimizerplanstoexecuteyourSQLstatements.Armedwiththisknowledge,youmaydeterminethatadditionalindexesareneeded,orthatyourequireanalternativemeansofselectingthedatayoudesire.

Ontheotherhand,whenitcomestousingJDBC,youneedtoknowaheadoftimetherelativestrengthsandweaknessesofusingauto-commit,SQL92syntax,andaStatementversusaPreparedStatementversusaCallableStatementobject.Inthischapter,we'llexaminetherelativeperformanceofvariousJDBCobjectsusingexampleprogramsthatreporttheamountoftimeittakestoaccomplishagiventask.We'llfirstlookatauto-commit.Next,we'lllookattheimpactoftheSQL92syntaxparser.Thenwe'llstartaseriesofcomparisonsoftheStatementobjectversusthePreparedStatementobjectversustheCallableStatementobject.Atthesametimewe'llalsoexaminetheperformanceoftheOCIversustheThindriverineachsituationtoseeif,asOracle'sclaims,thereisasignificantenoughperformancegainwiththeOCIdriverthatyoushoulduseitinsteadoftheThindriver.Forthemostpart,ourdiscussionswillbebasedontimingdatafor1,000insertsintothetestperformancetableTESTXXXPERF.Thereareseparateprogramsforperformingthese1,000insertsusingtheOCIdriverandtheThindriver.

Theperformancetestprogramsthemselvesareverysimpleandareavailableonlinewiththerestoftheexamplesinthisbook.However,forbrevity,I'llnotshowthecodefortheexamplesinthischapter.I'llonlytalkaboutthem.Althoughtheactualtimingvalueschangefromsystemtosystem,theirrelativevalues,orratiosfromonesystemtoanother,remainconsistent.ThetimingsusedinthischapterweregatheredusingWindows2000.Usingobjectivedatafromtheseprogramsallowsustocometofactualconclusionsonwhichfactorsimproveperformance,ratherthanrelyingonhearsay.

I'msureyou'llbesurprisedattherealityofperformancefortheseobjects,andIhopeyou'llusethisknowledgetoyouradvantage.Let'sgetstartedwithalookatthetestingframeworkusedinthischapter.

ATestingFramework

Forthemostpart,thetestprogramsinthischapterreportthetimingsforinsertingdataintoatable.IpickedanINSERTstatementbecauseiteliminatestheperformancegainofthedatabaseblockbuffersthatmayskewtimingsforanUPDATE,DELETE,orSELECT.

Thetesttableusedintheexampleprogramsinthischapterisasimplerelationaltable.IwantedittohaveaNUMBER,asmallVARCHAR2,alargeVARCHAR2,andaDATEcolumn.TableTESTXXXPERFisdefinedas:

createtableTestXXXPerf(

idnumber,

codevarchar2(30),

descrvarchar2(80),

insert_uservarchar2(30),

insert_datedate)

tablespaceuserspctfree20

storage(initial1Mnext1Mpctincrease0);

altertableTestXXXPerf

addconstraintTestXXXPerf_Pk

primarykey(id)

usingindex

tablespaceuserspctfree20

storage(initial1Mnext1Mpctincrease0);

Theinitialextentsizeusedforthetablemakesitunlikelythatthedatabasewillneedtotakethetimetoallocateanotherextentduringtheexecutionofoneofthetestprograms.Therefore,extentallocationwillnotimpactthetimings.Giventhisbackground,youshouldhaveacontexttounderstandwhatisdoneineachsectionbyeachtestprogram.

Auto-Commit

Bydefault,JDBC'sauto-commitfeatureison,whichmeansthateachSQLstatementiscommittedasitisexecuted.IfmorethanoneSQLstatementisexecutedbyyourprogram,thenasmallperformanceincreasecanbeachievedbyturningoffauto-commit.

Let'stakealookatsomenumbers.Table19-1showstheaveragetime,inmilliseconds,neededtoinsert1,000rowsintotheTESTXXXPERFtableusingaStatementobject.Thetimingsrepresenttheaveragefromthreerunsoftheprogram.Bothdriversexperienceapproximatelya

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 医药卫生 > 基础医学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1