资源预览内容
第1页 / 共15页
第2页 / 共15页
第3页 / 共15页
第4页 / 共15页
第5页 / 共15页
第6页 / 共15页
第7页 / 共15页
第8页 / 共15页
第9页 / 共15页
第10页 / 共15页
亲,该文档总共15页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
SQLServerODBCstandardSecurity:Driver=SQLServer;Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;trustedconnection:Driver=SQLServer;Server=Aron1;Database=pubs;Trusted_Connection=yes;promptforusernameandpassword:oConn.Properties(Prompt)=adPromptAlwaysoConn.OpenDriver=SQLServer;Server=Aron1;DataBase=pubs;OLEDB,OleDbConnection(.NET)standardSecurity:Provider=sqloledb;DataSource=Aron1;InitialCatalog=pubs;UserId=sa;Password=asdasd;trustedConnection:Provider=sqloledb;DataSource=Aron1;InitialCatalog=pubs;IntegratedSecurity=SSPI;(useserverNameinstanceNameasDataSourcetouseanspecifikSQLServerinstance,onlySQLServer2000)promptforusernameandpassword:oConn.Provider=sqloledboConn.Properties(Prompt)=adPromptAlwaysoConn.OpenDataSource=Aron1;InitialCatalog=pubs;connectviaanIPaddress:Provider=sqloledb;DataSource=190.190.200.100,1433;NetworkLibrary=DBMSSOCN;lnitialCatalog=pubs;UserID=sa;Password=asdasd;(dbmssocn=tcp/ipinsteadofNamedPipes,attheendoftheDataSourceistheporttouse(1433isthedefault)SqlConnection(.NET)standardSecurity:DataSource=Aron1;InitialCatalog=pubs;UserId=sa;Password=asdasd;-or-Server=Aron1;Database=pubs;UserID=sa;Password=asdasd;Trusted_Connection=False(boothconnectionstringsproducesthesameresult)trustedConnection:DataSource=Aron1;InitialCatalog=pubs;IntegratedSecurity=SSPI;-or-Server=Aron1;Database=pubs;Trusted_Connection=True;(boothconnectionstringsproducesthesameresult)(useserverNameinstanceNameasDataSourcetouseanspecifikSQLServerinstance,onlySQLServer2000)connectviaanIPaddress:DataSource=190.190.200.100,1433;NetworkLibrary=DBMSSOCN;InitialCatalog=pubs;UserID=sa;Password=asdasd;(dbmssocn=tcp/ipinsteadofNamedPipes,attheendoftheDataSourceistheporttouse(1433isthedefault)declaretheSqlConnection:C#:usingSystem.Data.SqlClient;SqlConnectionoSQLConn=newSqlConnection();oSQLConn.ConnectionString=myconnectionstring;oSQLConn.Open();VB.NET:ImportsSystem.Data.SqlClientDimoSQLConnAsSqlConnection=NewSqlConnection()oSQLConn.ConnectionString=myconnectionstringoSQLConn.Open()DataShapemsDataShapeProvider=MSDataShape;DataProvider=SQLOLEDB;DataSource=Aron1;lnitialCatalog=pubs;UserID=sa;Password=asdasd;wanttolearndatashaping?Checkout4GuyfFromRollasgreatarticleaboutDataShapingReadmoreHowtodefinewhichnetworkprotocoltouseExample:Provider=sqloledb;DataSource=190.190.200.100,1433;NetworkLibrary=DBMSSOCN;InitialCatalog=pubs;UserID=sa;Password=asdasd;NameNetworklibrarydbnmpntwWin32NamedPipesdbmssocnWin32WinsockTCP/IPdbmsspxnWin32SPX/IPXdbmsvinnWin32BanyanVinesdbmsrpcnWin32Multi-Protocol(WindowsRPC)importantnote!WhenconnectingthroughtheSQLOLEDBproviderusethesyntaxNetworkLibrary=dbmssocnandwhenconnectingthroughMSDASQLproviderusethesyntaxNetwork=dbmssocnAllSqlConnectionconnectionstringpropertiesThistableshowsallconnectionstringpropertiesfortheADO.NETSqlConnectionobject.MostofthepropertiesarealsousedinADO.Allpropertiesanddescriptionsisfrommsdn.NameDefaultDescriptionApplicationNameThenameoftheapplication,or.NetSqlClientDataProviderifnoapplicationnameisprovided.AttachDBFilename-or-extendedproperties-or-InitialFileNameThenameoftheprimaryfile,includingthefullpathname,ofanattachabledatabase.Thedatabasenamemustbespecifiedwiththekeyworddatabase.ConnectTimeout-or-ConnectionTimeout15Thelengthoftime(inseconds)towaitforaconnectiontotheserverbeforeterminatingtheattemptandgeneratinganerror.ConnectionLifetime0Whenaconnectionisreturnedtothepool,itscreationtimeiscomparedwiththecurrenttime,andtheconnectionisdestroyedifthattimespan(inseconds)exceedsthevaluespecifiedbyconnectionlifetime.Usefulinclusteredconfigurationstoforceloadbalancingbetweenarunningserverandaserverjustbroughton-Iine.ConnectionResettrueDetermineswhetherthedatabaseconnectionisresetwhenbeingremovedfromthepool.Settingtofalseavoidsmakinganadditionalserverround-tripwhenobtainingaconnection,buttheprogrammermustbeawarethattheconnectionstateisnotbeingreset.CurrentLanguageTheSQLServerLanguagerecordname.DataSource-or-Server-or-Address-or-Addr-or-NetworkAddressThenameornetworkaddressoftheinstaneeofSQLServertowhichtoconnect.EnlisttrueWhentrue,thepoolerautomaticallyenliststheconnectioninthecreationthreadscurrenttransactioncontext.InitialCatalog-or-DatabaseThenameofthedatabase.IntegratedSecurity-or-Trusted_ConnectionfalseWhethertheconnectionistobeasecureconnectionornot.Recognizedvaluesaretrue,false,andsspi,whichisequivalenttotrue.MaxPoolSize100Themaximumnumberofconnectionsallowedinthepool.MinPoolSize0Theminimumnumberofconnectionsallowedinthepool.NetworkLibrary-or-NetdbmssocnThenetworklibraryusedtoestablishaconnectiontoaninstanceofSQLServer.Supportedvaluesincludedbnmpntw(NamedPipes),dbmsrpcn(Multiprotocol),dbmsadsn(AppleTalk),dbmsgnet(VIA),dbmsipcn(SharedMemory)anddbmsspxn(IPX/SPX),anddbmssocn(TCP/IP).ThecorrespondingnetworkDLLmustbeinstalledonthesystemtowhichyouconnect.Ifyoudonotspecifyanetworkandyouu
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号