资源描述:
《Java语言程序设计10E LiangPPT习题案例32slide.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1Chapter32JavaDatabaseProgramming2ObjectivesTounderstandtheconceptofdatabaseanddatabasemanagementsystems(§32.2).Tounderstandtherelationaldatamodel:relationaldatastructures,constraints,andlanguages(§32.2).TouseSQLtocreateanddroptables,andtoretrieveandmodifydata(§32.3).Tolea
2、rnhowtoloadadriver,connecttoadatabase,executestatements,andprocessresultsetsusingJDBC(§32.4).TousepreparedstatementstoexecuteprecompiledSQLstatements(§32.5).TousecallablestatementstoexecutestoredSQLproceduresandfunctions(§32.6).ToexploredatabasemetadatausingtheDatabaseMeta
3、DataandResultSetMetaDatainterfaces(§32.7).3WhatisaDatabaseSystem?e.g.,Access,MySQL,Oracle,andMSSQLServer4DatabaseApplicationSystems5RationalDatabaseandRelationalDataModelMostoftoday’sdatabasesystemsarerelationaldatabasesystems,basedontherelationaldatamodel.Arelationaldatam
4、odelhasthreekeyArelationaldatamodelhasthreekeycomponents:structure,integrityandlanguages.Structuredefinestherepresentationofthedata.Integrityimposesconstraintsonthedata.Languageprovidesthemeansforaccessingandmanipulatingdata.6RelationalStructureArelationaldatabaseconsistso
5、fasetofrelations.Arelationhastwothingsinone:aschemaandaninstanceoftheschema.Theschemadefinestherelationandaninstanceisthecontentoftherelationatagiventime.Aninstanceofarelationisnothingmorethanatablewithrowsandnamedcolumns.Forconveniencewithnoconfusion,wereferinstancesofrel
6、ationsasjustrelationsortables.7CourseTable8StudentTable9EnrollmentTable10Tablevs.FileNOTE:Atableorarelationisnotsameasafile.Mostoftherelationaldatabasesystemsstoremultipletablesinafile.11IntegrityConstraintsAnintegrityconstraintimposesaconditionthatalllegalinstancesofthere
7、lationsmustsatisfy.Ingeneral,therearethreetypesofconstraints:domainconstraint,primarykeyconstraint,andforeignkeyconstraint.Domainconstraintsandprimarykeyconstraintsareknownasintra-relationalconstraints,meaningthataconstraintinvolvesonlyonerelation.Theforeignkeyconstraintis
8、knownasinter-relational,meaningthataconstraintinvolvesmorethanonerelation.12DomainConstra