下载

2下载券

加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 ASP.NETNET中各种数据库连接大全

ASP.NETNET中各种数据库连接大全.doc

ASP.NETNET中各种数据库连接大全

飞行者
2018-09-05 0人阅读 举报 0 0 暂无简介

简介:本文档为《ASP.NETNET中各种数据库连接大全doc》,可适用于IT/计算机领域

NET中各种数据库连接大全SQLServerODBCStandardSecurity:"Driver={SQLServer}Server=AronDatabase=pubsUid=saPwd=asdasd"Trustedconnection:"Driver={SQLServer}Server=AronDatabase=pubsTrustedConnection=yes"Promptforusernameandpassword:oConnProperties("Prompt")=adPromptAlwaysoConnOpen"Driver={SQLServer}Server=AronDataBase=pubs"OLEDB,OleDbConnection(NET)StandardSecurity:"Provider=sqloledbDataSource=AronInitialCatalog=pubsUserId=saPassword=asdasd"TrustedConnection:"Provider=sqloledbDataSource=AronInitialCatalog=pubsIntegratedSecurity=SSPI"(useserverNameinstanceNameasDataSourcetouseanspecifikSQLServerinstance,onlySQLServer)Promptforusernameandpassword:oConnProvider="sqloledb"oConnProperties("Prompt")=adPromptAlwaysoConnOpen"DataSource=AronInitialCatalog=pubs"ConnectviaanIPaddress:"Provider=sqloledbDataSource=,NetworkLibrary=DBMSSOCNInitialCatalog=pubsUserID=saPassword=asdasd"(DBMSSOCN=TCPIPinsteadofNamedPipes,attheendoftheDataSourceistheporttouse(isthedefault))SqlConnection(NET)StandardSecurity:"DataSource=AronInitialCatalog=pubsUserId=saPassword=asdasd"TrustedConnection:"DataSource=AronInitialCatalog=pubsIntegratedSecurity=SSPI"(useserverNameinstanceNameasDataSourcetouseanspecifikSQLServerinstance,onlySQLServer)ConnectviaanIPaddress:"DataSource=,NetworkLibrary=DBMSSOCNInitialCatalog=pubsUserID=saPassword=asdasd"(DBMSSOCN=TCPIPinsteadofNamedPipes,attheendoftheDataSourceistheporttouse(isthedefault))DeclaretheSqlConnection:C#:usingSystemDataSqlClientSqlConnectionoSQLConn=newSqlConnection()oSQLConnConnectionString="myconnectionstring"oSQLConnOpen()VBNET:ImportsSystemDataSqlClientDimoSQLConnAsSqlConnection=NewSqlConnection()oSQLConnConnectionString="myconnectionstring"oSQLConnOpen()DataShapeMSDataShape"Provider=MSDataShapeDataProvider=SQLOLEDBDataSource=AronInitialCatalog=pubsUserID=saPassword=asdasd"ReadmoreHowtodefinewichnetworkprotocoltouseExample:"Provider=sqloledbDataSource=,NetworkLibrary=DBMSSOCNInitialCatalog=pubsUserID=saPassword=asdasd"NameNetworklibrarydbnmpntwWinNamedPipesdbmssocnWinWinsockTCPIPdbmsspxnWinSPXIPXdbmsvinnWinBanyanVinesdbmsrpcnWinMultiProtocol(WindowsRPC)Importantnote!WhenconnectingthroughtheSQLOLEDBproviderusethesyntaxNetworkLibrary=dbmssocnandwhenconnectingthroughMSDASQLproviderusethesyntaxNetwork=dbmssocnAllSqlConnectionconnectionstringpropertiesThistableshowsallconnectionstringpropertiesfortheADONETSqlConnectionobjectMostofthepropertiesarealsousedinADOAllpropertiesanddescriptionsisfrommsdnNameDefaultDescriptionApplicationNameThenameoftheapplication,orNetSqlClientDataProviderifnoapplicationnameisprovidedAttachDBFilenameorextendedpropertiesorInitialFileNameThenameoftheprimaryfile,includingthefullpathname,ofanattachabledatabaseThedatabasenamemustbespecifiedwiththekeyworddatabaseConnectTimeoutorConnectionTimeoutThelengthoftime(inseconds)towaitforaconnectiontotheserverbeforeterminatingtheattemptandgeneratinganerrorConnectionLifetimeWhenaconnectionisreturnedtothepool,itscreationtimeiscomparedwiththecurrenttime,andtheconnectionisdestroyedifthattimespan(inseconds)exceedsthevaluespecifiedbyconnectionlifetimeUsefulinclusteredconfigurationstoforceloadbalancingbetweenarunningserverandaserverjustbroughtonlineConnectionResettrueDetermineswhetherthedatabaseconnectionisresetwhenbeingremovedfromthepoolSettingtofalseavoidsmakinganadditionalserverroundtripwhenobtainingaconnection,buttheprogrammermustbeawarethattheconnectionstateisnotbeingresetCurrentLanguageTheSQLServerLanguagerecordnameDataSourceorServerorAddressorAddrorNetworkAddressThenameornetworkaddressoftheinstanceofSQLServertowhichtoconnectEnlisttrueWhentrue,thepoolerautomaticallyenliststheconnectioninthecreationthreadscurrenttransactioncontextInitialCatalogorDatabaseThenameofthedatabaseIntegratedSecurityorTrustedConnectionfalseWhethertheconnectionistobeasecureconnectionornotRecognizedvaluesaretrue,false,andsspi,whichisequivalenttotrueMaxPoolSizeThemaximumnumberofconnectionsallowedinthepoolMinPoolSizeTheminimumnumberofconnectionsallowedinthepoolNetworkLibraryorNetdbmssocnThenetworklibraryusedtoestablishaconnectiontoaninstanceofSQLServerSupportedvaluesincludedbnmpntw(NamedPipes),dbmsrpcn(Multiprotocol),dbmsadsn(AppleTalk),dbmsgnet(VIA),dbmsipcn(SharedMemory)anddbmsspxn(IPXSPX),anddbmssocn(TCPIP)ThecorrespondingnetworkDLLmustbeinstalledonthesystemtowhichyouconnectIfyoudonotspecifyanetworkandyouusealocalserver(forexample,""or"(local)"),sharedmemoryisusedPacketSizeSizeinbytesofthenetworkpacketsusedtocommunicatewithaninstanceofSQLServerPasswordorPwdThepasswordfortheSQLServeraccountloggingonPersistSecurityInfofalseWhensettofalse,securitysensitiveinformation,suchasthepassword,isnotreturnedaspartoftheconnectioniftheconnectionisopenorhaseverbeeninanopenstateResettingtheconnectionstringresetsallconnectionstringvaluesincludingthepasswordPoolingtrueWhentrue,theSQLConnectionobjectisdrawnfromtheappropriatepool,orifnecessary,iscreatedandaddedtotheappropriatepoolUserIDTheSQLServerloginaccountWorkstationIDthelocalcomputernameThenameoftheworkstationconnectingtoSQLServerNoteUsetoseparateeachpropertyIfanameoccursmorethanonce,thevaluefromthelastoneintheconnectionstringwillbeusedIfyouarebuildingyourconnectionstringinyourappusingvaluesfromuserinputfields,makesuretheusercantchangetheconnectionstringbyinsertinganadditionalpropertywithanothervaluewithintheuservalueAccessODBCStandardSecurity:"Driver={MicrosoftAccessDriver(*mdb)}Dbq=somepathmydbmdbUid=AdminPwd=asdasd"Workgroup:"Driver={MicrosoftAccessDriver(*mdb)}Dbq=somepathmydbmdbSystemDB=somepathmydbmdw","admin",""OLEDB,OleDbConnection(NET)Standardsecurity:"Provider=MicrosoftJetOLEDBDataSource=somepathmydbmdbUserId=adminPassword=asdasd"Workgroup(systemdatabase):"Provider=MicrosoftJetOLEDBDataSource=somepathmydbmdbJetOLEDB:SystemDatabase=systemmdw","admin",""Withpassword:"Provider=MicrosoftJetOLEDBDataSource=somepathmydbmdbJetOLEDB:DatabasePassword=MyDbPassword","admin",""OracleODBCNewversion:"Driver={MicrosoftODBCforOracle}Server=OracleServerworldUid=UsernamePwd=asdasd"Oldversion:"Driver={MicrosoftODBCDriverforOracle}ConnectString=OracleServerworldUid=myUsernamePwd=myPassword"OLEDB,OleDbConnection(NET)Standardsecurity:"Provider=msdaoraDataSource=MyOracleDBUserId=UserNamePassword=asdasd"ThisonesfromMicrosoft,thefollowingarefromOracleStandardSecurity:"Provider=OraOLEDBOracleDataSource=MyOracleDBUserId=UsernamePassword=asdasd"TrustedConnection:"Provider=OraOLEDBOracleDataSource=MyOracleDBOSAuthent="OracleConnection(NET)Standard:"DataSource=OracleiIntegratedSecurity=yes"ThisoneworksonlywithOracleireleaseorlaterDeclaretheOracleConnection:C#:usingSystemDataOracleClientOracleConnectionoOracleConn=newOracleConnection()oOracleConnConnectionString="myconnectionstring"oOracleConnOpen()VBNET:ImportsSystemDataOracleClientDimoOracleConnAsOracleConnection=NewOracleConnection()oOracleConnConnectionString="myconnectionstring"oOracleConnOpen()DataShapeMSDataShape:"Provider=MSDataShapePersistSecurityInfo=FalseDataProvider=MSDAORADataSource=oracuserid=usernamepassword=mypw"MySQLODBCLocaldatabase:"Driver={mySQL}Server=mySrvNameOption=Database=mydatabase"Remotedatabase:"Driver={mySQL}Server=datadomaincomPort=Option=Stmt=Database=mydatabaseUid=usernamePwd=password"OLEDB,OleDbConnection(NET)Standard:"Provider=MySQLProvDataSource=mydbUserId=UserNamePassword=asdasd"MySqlConnection(NET)EID:"DataSource=serverDatabase=mydbUserID=usernamePassword=pwdCommandLogging=false"ThisoneisusedwitheInfoDesignsdbProvider,anaddontoNETDeclaretheMySqlConnection:C#:usingEIDMySqlClientMySqlConnectionoMySqlConn=newMySqlConnection()oMySqlConnConnectionString="myconnectionstring"oMySqlConnOpen()VBNET:ImportsEIDMySqlClientDimoMySqlConnAsMySqlConnection=NewMySqlConnection()oMySqlConnConnectionString="myconnectionstring"oMySqlConnOpen()IBMDBOLEDB,OleDbConnection(NET)frommsTCPIP:"Provider=DBOLEDBNetworkTransportLibrary=TCPIPNetworkAddress=XXXXXXXXXXXXInitialCatalog=MyCtlgPackageCollection=MyPkgColDefaultSchema=SchemaUserID=MyUserPassword=MyPW"APPC:"Provider=DBOLEDBAPPCLocalLUAlias=MyAliasAPPCRemoteLUAlias=MyRemoteInitialCatalog=MyCtlgPackageCollection=MyPkgColDefaultSchema=SchemaUserID=MyUserPassword=MyPW"SybaseODBCStandard:"Driver={SYBASESYSTEM}Srvr=AronUid=usernamePwd=password"Intersolv:"Driver={INTERSOLVBITSybase}Srvr=AronUid=usernamePwd=password"InformixODBCInformix:"Dsn=Driver={INFORMIXBIT}Host=hostnameServer=myserverService=servicenameProtocol=olsoctcpDatabase=mydbUID=usernamePWD=myPwdInformixCLI:"Driver={InformixCLI(Bit)}Server=myserverDatabase=mydbUid=usernamePwd=myPwd"DSNODBCDSN:"DSN=myDsnUid=usernamePwd="FileDSN:"FILEDSN=c:myDatadsnUid=usernamePwd="ExcelODBCStandard:"Driver={MicrosoftExcelDriver(*xls)}DriverId=Dbq=C:MyExcelxlsDefaultDir=c:mypath"OLEDBStandard:"Provider=MicrosoftJetOLEDBDataSource=C:MyExcelxlsExtendedProperties=ExcelHDR=Yes""HDR=Yes"indicatesthatthefirstrowcontainscolumnnames,notdataDBFFoxProODBCstandard:"Driver={MicrosoftdBASEDriver(*dbf)}DriverID=Dbq=c:mydbpath"OLEDB,OleDbConnection(NET)standard:"Provider=MicrosoftJetOLEDBDataSource=c:folderExtendedProperties=dBASEIVUserID=AdminPassword="PervasiveODBCStandard:"Driver={PervasiveODBCClientInterface}ServerName=srvnamedbq=dbname"UDLUDLUDL:"FileName=c:myDataLinkudl"

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

文档小程序码

使用微信“扫一扫”扫码寻找文档

1

打开微信

2

扫描小程序码

3

发布寻找信息

4

等待寻找结果

我知道了
评分:

/10

ASP.NETNET中各种数据库连接大全

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利