¾È±Ô °øºÎ¹æ

ACTIVE SERVER PAGE > Connection - Attributes

µî·ÏÀÏ : 2017-07-04 16:59 Á¶È¸¼ö : 53,775


 ¾È³çÇϼ¼¿ä...
Connection °³Ã¼¿¡ ´ëÇؼ­ °£´ÜÈ÷ ¾Ë¾Æº¸¼ÌÂÇ????
¿À´ÃÀº ÀÌ °³Ã¼ÀÇ ¼Ó¼ºÀÌ ¾î¶²°ÍµéÀÌ ÀÖ´ÂÁö¸¦ ¾Ë¾Æº¸µµ·Ï ÇÏ°Ú½À´Ï´Ù.
±×¸®±¸, ´ÙÀ½¿¡´Â ¸Þ¼Òµå´Â ¶Ç ¾î¶²°ÍµéÀÌ ÀÖ³ª ¾Ë¾ÆºÁ¾ß °ÚÁö¿ä???

  5.3.1 CommandTimeOut ¼Ó¼º
 
»ç¿ë¿¹´Â ¾Æ·¡¿Í °°½À´Ï´Ù.

Set objCnn = Server.CreateObject("ADODB.Connection")
objCnn.Open ("Provider=SQLOLEDB;User ID=sa;Password=;Initial Catalog=test;Data Source=MOBBIE-ANKYU")
objCnn.CommandTimeout=0 strSql="SELECT COUNT(BOARD_IDX) FROM BOARD"
set objRs=ObjCnn.Execute(strSql)
response.write objRs(0)

 
  ÀÌ ¼Ó¼ºÀº ¸í·ÉÀ» ½ÇÇàÇÏ´Â µ¿¾È ½ÇÇàÀÌ Á¦´ë·Î µÇÁö ¾ÊÀ¸¸é ¾ó¸¶³ª ¿À·§µ¿¾È ±â´Ù·È´Ù°¡ ½ÇÇàÀ» ÁßÁöÇÏ°í ¿À·ù¸¦
  ¹ß»ý½ÃųÁö¸¦ ¼³Á¤ÇÏ´Â ¼Ó¼ºÀÔ´Ï´Ù.  ÃÊ ´ÜÀ§·Î ÀÌ·ç¾îÁö¸ç, ±âº»°ªÀº 30ÃÊ ÀÔ´Ï´Ù.
 
  5.3.2 ConnectionString ¼Ó¼º
 
Set objCnn = Server.CreateObject("ADODB.Connection")
objCnn.CursorLocation = adUseClient objCnn.ConnectionString = "Provider=MSDAORA.1;User ID=xxx ;Data Source=xxx;User Id=xx;PASSWORD=xxx;"
objCnn.Open


ÀÌ ¼Ó¼ºÀº µ¥ÀÌÅͺ£À̽º¿¡ Á¢¼ÓÇϱâ À§ÇÑ Á¤º¸µéÀ» ÁöÁ¤ÇÏ´Â ¼Ó¼ºÀÔ´Ï´Ù. 
ÀÌ °ª¿¡ µû¶ó ODBC¸¦ »ç¿ëÇÒÁö, OLEDB Provider¸¦ »ç¿ëÇÏ°Ô µÉÁö °áÁ¤ÇÕ´Ï´Ù.
Á¢¼ÓÇÒ µ¥ÀÌÅͺ£À̽º¿Í ¼­¹ö, ±×¸®±¸ Á¢¼Ó ±ÇÇÑÀÇ »ç¿ëÀÚ¿Í password µîÀ» ÁöÁ¤ÇÕ´Ï´Ù.

  5.3.3 ConnectionTimeout ¼Ó¼º
 
  ÀÌ ¼Ó¼ºÀº µ¥ÀÌÅͺ£À̽º¿¡ ¿¬°áÀÌ ÀÌ·ç¾îÁö±â¸¦ ¾ó¸¶³ª ¿À·§µ¿¾È ±â´Ù·È´Ù°¡ ½ÇÇàÀ» ÁßÁöÇÏ°í ¿À·ù¸¦ ¹ß»ý½ÃųÁö¸¦
  ¼³Á¤ÇÏ´Â ¼Ó¼ºÀÔ´Ï´Ù.
 
  ÀÌ °ªÀ» 0À¸·Î ¼³Á¤ÇÏ°Ô µÇ¸é ¿¬°áÀÌ ÀÌ·ç¾îÁú¶§±îÁö ¹«ÇÑ ´ë±â ÇÏ°Ô µË´Ï´Ù.
 
Set objCnn = Server.CreateObject("ADODB.Connection")
objCnn.ConnectionTimeOut=10


À§ÀÇ ¿¹Á¦´Â ¿¬°á½Ã°£À» 10ÃÊ·Î ÁöÁ¤ÇÑ ¿¹Á¦ ÀÔ´Ï´Ù.

  5.3.4 CursorLocation ¼Ó¼º

Set objCnn = Server.CreateObject("ADODB.Connection")
objCnn.CursorLocation = adUseClient objCnn.ConnectionString = "Provider=MSDAORA.1;User ID=xxx ;Data Source=xxx;User Id=xx;PASSWORD=xxx;"
objCnn.Open


Ä¿¼­ ¿£ÁøÀÌ »ý¼ºµÉ À§Ä¡¸¦ ÁöÁ¤Çϰųª ÇöÀç CursorLocation ¼³Á¤ °ªÀ» ÀÐ¾î ¿Ã¼ö ÀÖ´Â ¼Ó¼ºÀÔ´Ï´Ù.
 
CursorLocation »ó¼ö
¼Ó ¼º °ª ¼³ ¸í
adUseNone
adUseServer
adUseClient
0
2
3
Ä¿¼­ ¼­ºñ½º¸¦ »ç¿ëÇÏÁö ¾Ê°Ú´Ù´Â ¼³Á¤À̸ç, ÀÌÀü¹öÀü°ú ȣȯÀ» À§ÇØ Á¦°øµÊ.
µðÆúÆ®°ª. µ¥ÀÌŸ Provider ¶Ç´Â µå¶óÀ̹ö°¡ Áö¿øÇÏ´Â Ä¿¼­.
·ÎÄà Ŀ¼­ ¶óÀ̺귯¸®¿¡ ÀÇÇؼ­ Á¦°øµÇ´Â Ŭ¶óÀ̾ðÆ® Ä¿¼­.
  
     
      CursorLocation ¼Ó¼ºÀº Connection °³Ã¼¿Í Recordset °³Ã¼°¡ °¡Áö°í ÀÖ´Â ¼Ó¼ºÀ̸ç, RDS¿¡¼­
      Ŭ¶óÀ̾ðÆ®ÃøÀÇ Recordset °³Ã¼³ª Connection°³Ã¼¸¦ »ç¿ëÇϱâ À§Çؼ­´Â adUserClient¸¦ »ç¿ëÇØ¾ß ÇÕ´Ï´Ù.
     
  5.3.5 DefaultDatabase ¼Ó¼º

Set objCnn = Server.CreateObject("ADODB.Connection")
objCnn.Open ("Provider=SQLOLEDB;User ID=sa;Password=;Data Source=MOBBIE-ANKYU")
objCnn.DefaultDatabase="test"
strSql="SELECT COUNT(BOARD_IDX) FROM BOARD"
set objRs=ObjCnn.Execute(strSql)
response.write objRs(0)

 
  DefaultDatabase ¼Ó¼ºÀº Connection °³Ã¼ÀÇ µðÆúÆ® µ¥ÀÌÅͺ£À̽º¸¦ ÁöÁ¤ÇÏ´Â ¼Ó¼ºÀÔ´Ï´Ù.
 
ÀÌ ¼Ó¼ºÀ» »©°í ¾Æ·¡Ã³·³ Initial Catalog ¿¡ ½á ³Ö¾îµµ µÇÁö¿ä.
 
objCnn.Open ("Provider=SQLOLEDB;User ID=sa;Password=;Initial Catalog=test;Data Source=MOBBIE-ANKYU")

  5.3.6 Properties ¼Ó¼º
 
  µ¥ÀÌÅÍ Provider¿¡ ´ëÇÑ ¼Ó¼º °³Ã¼µéÀÇ Ä÷º¼ÇÀ¸·Î Àбâ Àü¿ëÀÔ´Ï´Ù.
 
¾î¶°ÇÑ Properties ¼Ó¼ºµéÀÌ ÀÖ´ÂÁö È®ÀÎÇϱâ À§Çؼ­´Â

<% Set objCnn = Server.CreateObject("ADODB.Connection")
objCnn.Open ("Provider=SQLOLEDB;User ID=sa;Password=;Initial Catalog=test;Data Source=MOBBIE-ANKYU")
for i=0 to objCnn.properties.count-1
response.write objCnn.properties(i).name & ":" & objCnn.properties(i).value&"<br>" next %>


À§Ã³·³ ÄÚµùÇؼ­ È®ÀÎÇØ º¸¼¼¿ä.....

¾î¶°ÇÑ ÇÁ·ÎÆÛƼ°¡ ÀÖ´ÂÁö È®ÀÎÇϽǼö ÀÖÁö¿ä?

Set objCnn = Server.CreateObject("ADODB.Connection")
objCnn.Open ("Provider=SQLOLEDB;User ID=sa;Password=;Initial Catalog=test;Data Source=MOBBIE-ANKYU")
response.write objCnn.Properties("DBMS Name")&"<br>"
response.write objCnn.Properties("DBMS Version")&"<br>"
response.write objCnn.Properties("Provider Name")&"<br>"


À§Ã³·³ Properties ¼Ó¼ºÀ» ÀÌ¿ëÇؼ­ ¿©·¯°¡Áö Á¤º¸¸¦ »Ì¾Æº¼¼ö ÀÖ½À´Ï´Ù.


  5.3.7 Version ¼Ó¼º
 
Set objCnn = Server.CreateObject("ADODB.Connection")
objCnn.Open ("Provider=SQLOLEDB;User ID=sa;Password=;Initial Catalog=test;Data Source=MOBBIE-ANKYU")
response.write objCnn.version


AdoÀÇ ¹öÀü Á¤º¸¸¦ º¸¿©ÁÝ´Ï´Ù.... ^^;


  5.3.8 Provider ¼Ó¼º
 
Set objCnn = Server.CreateObject("ADODB.Connection")
objCnn.provider="sqloledb" objCnn.Open ("User ID=sa;Password=;Initial Catalog=test;Data Source=MOBBIE-ANKYU")
response.write objCnn.provider


À§ÀÇ ¿¹Á¦´Â provider ¸¦ ÁöÁ¤ÇÏ´Â ¿¹Á¦ÀÔ´Ï´Ù.
 
  Connection °³Ã¼¿¡ ´ëÇÑ ¿©·¯°¡Áö ÇÁ·ÎÆÛƼ¸¦ ¾Ë¾Æº¸¾Ò³×¿©.... ^^;
  ±Ùµ¥, ÀÌ°Å ¾µµ¥°¡ ÀÖÀ»·Á³ª ¸ð¸£°Ú³×¿µ.... ÇìÇì
 
  ´ÙÀ½¿¡´Â Connection ¸Þ¼­µå µé¿¡ ´ëÇؼ­ ¾Ë¾Æº¸µµ·Ï ÇÏ°Ú½À´Ï´Ù.
 
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.