Database °æ (¾«»ªÇø)
·¢ÐÅÈË: joy ( ÓêËͻƻ軨Ò×Âä), ÐÅÇø: Database
±ê Ìâ: ÓÃDelphiµÄInterBaseÊý¾Ý¿â¿ª·¢Client/ServerÓ¦ÓóÌÐ
·¢ÐÅÕ¾: ×Ï ¶¡ Ïã (Tue Jul 21 21:06:55 1998), תÐÅ
Ëæ×ÅClient/ServerÊý¾Ý¿â¼¼ÊõµÄ²»¶ÏÍêÉÆ,Ô½À´Ô½¶àµÄÊý¾Ý¿â½«°´
ÕÕÕâÖÖģʽ¿ª·¢¡£ÒÔÇ°ÔÚ´óÐÍ»úÉÏÔËÐеÄÊý¾Ý¿âÈçOracle¡¢SybaseµÈ
ÒÆÖ²µ½Ð¡ÐÍ·þÎñÆ÷ÉÏÒÔºó,¿ª·¢»ùÓÚSQLµÄÊý¾Ý¿âÓ¦ÓõÄÇ÷ÊƸü¼ÓÃ÷ÏÔ
ÁË¡£Ëü±ÈÒÔÍùµÄÍøÂçÊý¾Ý¿âϵͳ,ÎÞÂÛÔÚ¼¼ÊõÉÏ»¹ÊÇÐÔÄÜÉÏ,¶¼ÓÐÁ˺Ü
´óµÄÌá¸ß¡£Borland¹«Ë¾µÄDelphiÊÇ¿ª·¢Êý¾Ý¿âÇ°¶ËµÄÓÅÐ㹤¾ß,¾ßÓÐ
¿ª·¢Ëٶȿ졢±à³Ì¼òµ¥¡¢½çÃæÓÅÃÀµÈÌصã,ÌرðÊǺÍDelphiÒ»Æð´øÀ´
µÄÊý¾Ý¿âInterBaseµÄ·þÎñÆ÷Local Server, ÔÚËùÓÐÀàËƱà³ÌÓïÑÔÖÐ
ÊÇ×î¾ßÌØÉ«µÄ¡£µ«ÔںܶàDelphiµÄ²Î¿¼×ÊÁÏÖжÔÕâÒ»µã½éÉܽÏÉÙ,¶ø
ËüÈ´ÊÇDelphi¿ª·¢Client/Server³ÌÐò×îÓÐÓúÍ×îÇ¿´óµÄ¹¤¾ß¡£Delph
i°²×°Íê±Ïºó,»á²úÉúÒ»¸öInterBaseÊý¾Ý¿âÀàÐ͵ÄLocal Server,ÓÐÁË
Ëü,¿ÉÒÔ±àдClient/ServerÊý¾Ý¿â³ÌÐò,¶øÎÞÐèÒ»¸öÕæÕýµÄºǫ́Êý¾Ý
¿â·þÎñÆ÷;Local ServerËäÈ»ÔÚ±¾µØ¼ÆËã»úÖÐÔËÐÐ,µ«ËüµÄÈ·°çÑÝÁËÒ»
¸öÊý¾Ý¿â·þÎñÆ÷µÄ½ÇÉ«,Ó¦ÓóÌÐòÔÚLocal ServerÉÏÔËÐкÍÔÚ·þÎñÆ÷
ÉÏÔËÐÐûÓÐʲô²»Ò»Ñù,Õâ¶ÔÓÚ¿ª·¢Client/ServerÊý¾Ý¿â³ÌÐòÀ´ËµÊÇ
ºÜÖØÒªµÄ,¿ÉÒÔ±ÜÃâÔÚÔËÐÐ×ÅÊý¾Ý¿âµÄ·þÎñÆ÷ÉÏ¿ª·¢³ÌÐò´øÀ´µÄΣÏÕ
ÐÔ¡£Í¬Ê±,Local ServerÉϵÄÊý¾Ý¿â¹ÜÀí¸ü¼Ó¼ò½à,¿ÉÒÔ¼Ó¿ìÓ¦ÓóÌÐò
µÄ¿ª·¢Ëٶȡ£ÏÂÃæ¼òµ¥½éÉÜÒ»ÏÂÀûÓÃLocal Server¿ª·¢Client/Serve
r³ÌÐòµÄ·½·¨¼°ÊÊÓ¦ÐÔ·½ÃæµÄÎÊÌâ,¹©´ó¼Ò²Î¿¼¡£
ÅäÖÃÊý¾Ý¿â
ΪÁËÔÚLocal ServerÉÏ¿ª·¢Êý¾Ý¿â³ÌÐò,Ê×ÏȱØÐëÔÚLocal Serve
rÉÏ°²×°Êý¾Ý¿âÈÃËüÄ£ÄâÍê³ÉÊý¾Ý¿â·þÎñÆ÷µÄ¸÷ÖÖ·þÎñ,¶ÔÄãÀ´Ëµ¾ÍÏñʹÓÃÒ»¸öSQL S
erver»òOracleÒ»Ñù¡£·½·¨ÈçÏÂ:
1.²é¿´¿ØÖÆÃæ°åµÄODBCÉèÖóÌÐò,È·±£Data SourceÏîÀïÓÐInterB
ase(Borland InterBa se)ÕâÒ»ÏȻºóÔÚDelphi³ÌÐò×éÀïÖ´ÐÐServe
r Manager³ÌÐò,Íê³ÉÊý¾Ý¿âµÄά»¤¹¤×÷,ÆäÖÐÓÐÒ»ÏîÊÇÓû§°²È«¹ÜÀí
¡£Óò˵¥TasksÖеÄUser SecurityÃüÁî´´½¨ÐÂÓû§,Éú³ÉÓû§ÃûºÍÃÜ
Âë,ÒÔ±¸ÔÚ´´½¨ÐÂÊý¾Ý¿âʱÓá£
2.ÔËÐÐDelphiÈí¼þ°üÖеÄWindows ISQL,Ö´ÐÐCREATE DATABASEÃü
Áî,Éú³ÉÒ»¸öÐÂÊý¾Ý¿â,¼ÙÉèÃüÃûΪTEST,Óû§ÃûºÍÃÜÂëÒªºÍµÚÒ»²½ÖÐ
²úÉúµÄÓû§ÄÚÈÝÒ»ÖÂ,È»ºóÔÚSQL STATEMENTÖдòÈë"CREATE TABLE NE
WTABLE(NAME CHAR(10),TELE-PHONE CHAR(14))"ÃüÁî,ÓÃRUNÖ´ÐÐ,½Ó
×Å¿ÉÒÔÓÃINSERT INTO NEWTABLEÃüÁî²åÈ뼸ÌõÊÔÑé¼Ç¼Ϊ±à³Ìʱµ÷ÊÔ
ÓÃ,ÔÙÍ˳öISQL¡£
3.ÔÚµÚ2²½Íê³ÉÒÔºó,ÔÚC:\IBLOCAL\BINĿ¼Ï¿ÉÒÔ·¢ÏÖÐÂÉú³ÉµÄ
Êý¾Ý¿âÎļþTEST¡£½Ó×ÅÔËÐÐDatabase Engine Configuration³ÌÐò,ÔÚ
¶ÔAliasesµÄ²Ù×÷ÖÐ,½¨Á¢Ò»¸öеÄAlias,Õâ¸öAliasµÄALIAS TYPEÊÇI
NTER-BASE,New Alias NameÊÇTEST,½«SERVER NAME¸Ä³É"C:\IBLOCAL
\BIN\TEST",ÆäËü²ÎÊýÄÚÈÝ¿ÉÒÔ°´ÕÕÐèÒª½øÐÐÐÞ¸Ä,È»ºó´æÅÌÍ˳ö¡£Õâ
Ò»²½Ò²¿ÉÒÔÔÚDatabas e DesktopÖÐÍê³É¡£
±à³Ì
ÏÖÔÚ¿ÉÒÔ±àдClient/ServerÊý¾Ý¿âµÄ³ÌÐòÁË¡£
1.ÔËÐÐDelphi³ÌÐòºó,н¨Ò»¸öPROJECT,ÔÚForm1ÉÏ·ÅÖÃData Acc
ess¹¹¼þData Source1 ºÍQuery1,ÒÔ¼°Data Control¹¹¼þDBGrid1ºÍDBNavigatorlµÈ¡£
2.ÔÚData SourcelµÄDataSetÊôÐÔÖÐÌîQuery1,ÔÚQuery1µÄDataba
seNameÊôÐÔÖÐÌîTEST»òÔÚÊôÐÔµÄÏÂÀ¿òÖÐÑ¡TEST,ÔÚQuery1µÄSQLÊôÐÔ
ÖмüÈëSQL²éѯÓï¾äÈçSELECT* FROM NEWTAB LE¡£
3.È»ºóÔÚDBGrid1ºÍDBNavigatorlµÄDataSourceÊôÐÔÖÐÌîDataSou
rcel,×îºó,½«Query1µÄActiveÊôÐÔÖÃΪTRUE,Õâʱ»á³öÏÖÊý¾Ý¿â×¢²á
¶Ô»°´°,Ö»ÒªÊäÈëµÄÓû§ÃûºÍÃÜÂëÎÞÎó,DBGrid 1Öн«³öÏÖQuery1²éѯ
µÄ½á¹û,Ò²¿ÉÒÔÔÚÔËÐÐʱÓÃQuery1µÄOPEN·½·¨À´´ò¿ª²éѯµÃµ½½á¹û¡£
Èç¹û½«Query1µÄRequestLiveÊôÐÔÉèÖÃΪTRUE,Ôò²»µ«¿ÉÒÔ²éѯÊý¾Ý¿â
,¶øÇÒÄܶÔÊý¾Ý¿â½øÐвåÈë¡¢¸üм°É¾³ýµÈ²Ù×÷,¸ù±¾²»ÐèÒª±àдSQL
Óï¾ä¡£
ÖÁ´Ë,Ò»¸ö×îС¶øÓÖÍêÕûµÄClient/ServerÊý¾Ý¿â³ÌÐò¾ÍÍê³ÉÁË¡£
Ö»Òª×÷Êʵ±µÄÐÞ¸Ä,¾Í¿ÉÒÔ±àд¸÷ÖÖʵÓõÄÊý¾Ý¿âÓ¦ÓóÌÐò¡£
¿ÉÒÆÖ²ÐÔ
ÓÃDelphi¿ª·¢Client/ServerÊý¾Ý¿â,´ó¼Ò×î¹ØÐĵľÍÊÇ¿ÉÒÆÖ²ÐÔ
,¶øÕâÒ»µã,Ç¡Ç¡¾ÍÊÇD elphiºÍInterBaseµÄLocal ServerµÄÓÅÊÆ¡£ÔÚ
Local ServerÉÏ¿ª·¢ÍêÒ»¸öÊý¾Ý¿â³ÌÐòºó,Ö»ÒªÔÚ¿ØÖÆÃæ°åÖÐODBCµÄS
ETUPÖн¨Á¢ÕæÕýÊý¾Ý¿â·þÎñÆ÷µÄÇý¶¯Æ÷,È»ºóÔÚDatabase DesktopÖÐ
Éú³ÉÀûÓøÃÇý¶¯Æ÷µÄÊý¾Ý¿â±ðÃû,²¢¶ÔQuery»òTableµÄÏàÓ¦ÊôÐÔÂÔ×÷
ÐÞ¸Ä,¾Í¿ÉÒÔÔÚ·þÎñÆ÷ÉÏÔËÐÐÁË¡£ÕâЩ¸Ä¶¯½ö½ö»¨·Ñ¼¸·ÖÖÓʱ¼ä¶øÒÑ,
ÆäËû»ù±¾Éϲ»±Ø¸Ä¶¯¡£µ«Òª×¢Òâ,¸÷ÖÖ²»Í¬µÄÊý¾Ý¿â·þÎñÆ÷µÄSQLÓïÑÔ
ÊÇÓÐËù²»Í¬µÄ,Èç¹ûÄãÓõÄÊDZê×¼µÄSQLÓï¾ä¶ø²»ÓÃÀ©Õ¹¹¦ÄÜ,ÄÇô¾Í
ûÓÐʲôÎÊÌâ,·ñÔòÐèÒª²Î¿¼ÏàÓ¦Êý¾Ý¿â·þÎñÆ÷µÄSQLÓï·¨¡£
--
¡ù À´Ô´:£®×Ï ¶¡ Ïã bbs.hit.edu.cn£®[FROM: 202.118.229.129]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
Ò³ÃæÖ´ÐÐʱ¼ä£º2.672ºÁÃë