ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

7-1-1 DNS-less³sµ²¸ê®Æ®w

7-1-1 DNS-less³sµ²¸ê®Æ®w

7-1-1        DNS-less³sµ²¸ê®Æ®w

³sµ²Access2000¸ê®Æ®w

³sµ²Access2000¸ê®Æ®w¬O¨Ï¥Îodbc_connect()¨ç¼Æ¡G
  1. odbc_connect(¡§ODBC¦r¦ê¡¨,¡¨±b¸¹,¡¨±K½X¡¨)
½Æ»s¥N½X
°ò¥»¤W¡A³sµ²Access2000¸ê®Æ®w®É¡AODBC¦r¦ê¤¤»Ýµ¹©w¨â­ÓODBC°Ñ¼Æ­È¡G

  • Driver¡G³sµ²Access2000¸ê®Æ®w©Ò»ÝªºODBCÅX°Êµ{¦¡¡C
  • DBQ¡GAccess2000¸ê®Æ®wªº¥»¾÷¡u¹ê»Ú¸ô®|¡v¡C

¥H³sµ²Access2000®æ¦¡ªºstudents1.mdb¸ê®Æ®wÀɮ׬°¹ï¶H¡A½d¨Òex07_01.PHP¡G
  1. <?
  2. $Provider="Driver={Microsoft Access Driver (*.mdb)};";
  3. $Path="DBQ=" . getcwd() . "\\" . "STUDENTS1.mdb";
  4. //³sµ²¸ê®Æ®w
  5. odbc_connect($Provider . $Path,"","");
  6. ?>
½Æ»s¥N½X

  • ¡u$Provider="Driver={Microsoft Access Driver (*.mdb)};"¡v¡G¨Ï¥ÎÅܼÆProvider¨Ó«ü©w§Ú­Ì­n¨Ï¥Îªº¸ê®Æ®wÅX°Êµ{¦¡¡A¦]¬°§Ú­Ì­n¶i¦æ³sµ²¦s¨úªº¸ê®Æ®wÀÉ®×Ãþ«¬¬°Access®æ¦¡¡A©Ò¥H¨Ï¥ÎªºODBC¸ê®Æ®wÅX°Êµ{¦¡¬°¡G¡u{Microsoft Access Driver (*.mdb)}¡v¡C
  • ¡u$Path="DBQ=" . getcwd() . "\\" . "STUDENTS1.mdb"¡v¡G¨Ï¥ÎÅܼÆPath¨Ó«ü©w§Ú­Ì­n¨Ï¥Îªº¸ê®Æ®w¸ô®|»PÀɦW¡F§Ú­Ì­n¶i¦æ³sµ²¦s¨úªº¸ê®Æ®wÀɮסA¥²¶·«ü©w¦¹¸ê®Æ®wÀɮתº§¹¾ã¸ô®|¦WºÙ¡A©Ò¥H§Ú­Ì¥²¶·¨Ï¥Î¡ygetcwd()¡z¤èªk¨Ó¨ú±o¥Ø«e«°¥«°õ¦æªº§¹¾ã¸ô®|¦WºÙ¡A±µµÛ¦A¥[¤W¸ê®Æ®wªº¬Û¹ï¸ô®|»P¸ê®Æ®wÀɮצWºÙ¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

³sµ²MS SQL2000¸ê®Æ®w
MS SQL¸ê®Æ®wªº³sµ²¥²¶·¹ïÀ³ºÞ²z¸ê®Æ®wªºMS SQL Server¡A©Ò¥H³sµ²ªº°Ñ¼Æ¤ñ¸û¦h¡G

  • Driver¡G³sµ²MS SQL Server©Ò»ÝªºODBCÅX°Êµ{¦¡¡C
  • Server¡G±ýµn¤JªºMS SQL Server¥D¾÷¦WºÙ¡C
  • UID¡Gµn¤JMS SQL Serverªº±b¸¹¡C
  • PWD¡Gµn¤JMS SQL Serverªº±K½X¡C
  • DataBase¡Gµn¤JMS SQL Server«á­n³sµ²¨Ï¥ÎªºSQL¸ê®Æ®w¦WºÙ¡C

¥H³sµ²MS SQL2000¤º«ØªºNorthwind¡]¥_­·¡^¸ê®Æ®wÀɮ׬°¹ï¶H¡A½d¨Òex07_02.PHP¡G
  1. <?
  2. $dnsless="Driver={SQL Server};" .
  3.          "Server=(Local);" .
  4.          "UID=SA;" .
  5.          "PWD=12345;" .
  6.          "DataBase=Northwind";
  7. //³sµ²¸ê®Æ®w
  8. $z=odbc_connect($dnsless,"","");
  9. echo $z;
  10. ?>
½Æ»s¥N½X
´£¥Ü¡I¡I
Server°Ñ¼Æ­È¡u¡]Local¡^¡v¥Nªíµn¤JªºSQL Server¬°¥»¾÷¦øªA¾¹¡A­Y«D¥»¾÷¦øªA¾¹¡A«hServer°Ñ¼Æ­È¥²¶·«ü©w¬°±ýµn¤JªºSQL Server¥D¾÷¦WºÙ¡C
¤ß¦w¡A¥­¦w   
µoªí¥ô¦óµL·N¸qªº·PÁ©ÎÄé¤ô¤å³¹¤@«ß¬å,¬Ã±¤±b¸¹,½Ð¸Ô¾\ª©³W!!

TOP

¬Æ»ò¬ODNS-less ?
DNS¤@¯ë¬O«üDomain Name System (©ÎService) , ¦ý»P¥»¸`¥DÃD¦ü¥GµLÃö . ¤£ª¾¬O§_À³¬°DSN ( Data Source Name ) ¤§»~?
yyc

TOP

        ÀR«ä¦Û¦b : ¦³´¼¼z¤~¯à¤À¿ëµ½´c¨¸¥¿¡F¦³Á¾µê¤~¯à«Ø¥ß¬üº¡¤H¥Í¡C
ªð¦^¦Cªí ¤W¤@¥DÃD