资源描述:
《Java语言程序设计与数据结构 基础篇原书第11版PPT及其他教辅资源34slide.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1Chapter34JavaDatabaseProgramming2ObjectivesTounderstandtheconceptofdatabaseanddatabasemanagementsystems(§34.2).Tounderstandtherelationaldatamodel:relationaldatastructures,constraints,andlanguages(§34.2).TouseSQLtocreateanddroptables,andtoretrieveandmodifydata(§34.3).Tolearnhowtoloadadriver,connec
2、ttoadatabase,executestatements,andprocessresultsetsusingJDBC(§34.4).TousepreparedstatementstoexecuteprecompiledSQLstatements(§34.5).TousecallablestatementstoexecutestoredSQLproceduresandfunctions(§34.6).ToexploredatabasemetadatausingtheDatabaseMetaDataandResultSetMetaDatainterfaces(§34.7).3Whatisa
3、DatabaseSystem?e.g.,Access,MySQL,Oracle,andMSSQLServer4DatabaseApplicationSystems5RationalDatabaseandRelationalDataModelMostoftoday’sdatabasesystemsarerelationaldatabasesystems,basedontherelationaldatamodel.ArelationaldatamodelhasthreekeyArelationaldatamodelhasthreekeycomponents:structure,integrit
4、yandlanguages.Structuredefinestherepresentationofthedata.Integrityimposesconstraintsonthedata.Languageprovidesthemeansforaccessingandmanipulatingdata.6RelationalStructureArelationaldatabaseconsistsofasetofrelations.Arelationhastwothingsinone:aschemaandaninstanceoftheschema.Theschemadefinestherelat
5、ionandaninstanceisthecontentoftherelationatagiventime.Aninstanceofarelationisnothingmorethanatablewithrowsandnamedcolumns.Forconveniencewithnoconfusion,wereferinstancesofrelationsasjustrelationsortables.7CourseTable8StudentTable9EnrollmentTable10Tablevs.FileNOTE:Atableorarelationisnotsameasafile.M
6、ostoftherelationaldatabasesystemsstoremultipletablesinafile.11IntegrityConstraintsAnintegrityconstraintimposesaconditionthatalllegalinstancesoftherelationsmustsatisfy.Ingeneral,therearethreetypesofconstraints:domainconstraint,primarykeyconstraint,andforeignkeyconstraint.Domainconstraintsandprimary
7、keyconstraintsareknownasintra-relationalconstraints,meaningthataconstraintinvolvesonlyonerelation.Theforeignkeyconstraintisknownasinter-relational,meaningthataconstraintinvolvesmorethanonerelation.12DomainConstra