Database connection highlights

zhaozj2021-02-16  60

SQL Server

ODBC OLE DB, OLEDBCONNECTION (.NET) SqlConnection (.NET) Data Shape Read More

Standard Security: "Driver = {SQL Server}; Server = Aron1; Database = pubs; Uid = sa; Pwd = asdasd;" Trusted connection: "Driver = {SQL Server}; Server = Aron1; Database = pubs; Trusted_Connection = yes "Prompt for username and password: Oconn.properties (" prompt ") = adpromptalwaysoconn.open" driver = {SQL Server}; server = aron1; database = public; "

Standard Security: "Provider = sqloledb; Data Source = Aron1; Initial Catalog = pubs; User Id = sa; Password = asdasd;" Trusted Connection: "Provider = sqloledb; Data Source = Aron1; Initial Catalog = pubs; Integrated Security = SSPI "

(Use Servername / InstanceName As Data Source To Use An Specifik Sqlserver Instance, "ONLY SQLSERVER2000)

Prompt for username and password: oConn.Provider = "sqloledb" oConn.Properties ( "Prompt") = adPromptAlwaysoConn.Open "Data Source = Aron1; Initial Catalog = pubs;" Connect via an IP address: "Provider = sqloledb; Data Source = 190.190.200.100, 1433; network library = dbms SOCN; Initial Catalog = Pubs; user ID = sa; password = asdasd; "

(DBMSSOCN = TCP / IP INSTEAD OF NAMED PIPES, AT THE End of The Data Source Is The Port To Use (1433 Is The Default))

Standard Security: "Data Source = aron1; initial catalog = pubs; user ID = sa; password = asdasd;" - or - "server = aron1; database = public; user id = sa; password = asdasd; trusted_connection = false booth connection strings produces the same result) Trusted Connection: "Data Source = Aron1; Initial Catalog = pubs; Integrated Security = SSPI;" - or - "Server = Aron1; Database = pubs; Trusted_Connection = True;" (booth connection strings produces The Same Result (Use Servername / InstanceName As Data Source To Use An Specifik Sqlserver Instance, Only SqlServer2000)

Connect Via An IP Address: "Data Source = 190.190.200.100, 1433; Network Library = dbms SOCN; Initial Catalog = Pubs; User ID = SA; Password = asdasd;"

(DBMSSOCN = TCP / IP INSTEAD OF NAMED PIPES, AT THE End of The Data Source Is The Port To Use (1433 Is The Default))

Declare the SqlConnection:

C #: using System.Data.SqlClient; SqlConnection oSQLConn = new SqlConnection (); oSQLConn.ConnectionString = "my connectionstring"; oSQLConn.Open (); VB.NET:Imports System.Data.SqlClientDim oSQLConn As SqlConnection = New SqlConnection () Osqlconn.connectionstring = "My Connectionstring" osqlconn.open ()

MS Data Shape "Province = MSDataShape; Data Provider = Sqloledb; Data Source = aron1; initial catalog = pubs; user ID = sa; password = asdasd;"

How To Define Wich Network Protocol To Use

Example: "provider = SQLOLEDB; DATA SOURCE = 190.190.200.100, 1433; network library = dbmssocn; initial catalog = pubs; user ID = sa; password = asdasd;"

NameNetwork librarydbnmpntwWin32 Named PipesdbmssocnWin32 Winsock TCP / IPdbmsspxnWin32 SPX / IPXdbmsvinnWin32 Banyan VinesdbmsrpcnWin32 Multi-Protocol (Windows RPC) Important note! When connecting through the SQLOLEDB provider use the syntax Network Library = dbmssocnand when connecting through MSDASQL provider use the syntax Network = dbmssocnAll SqlConnection connectionstring properties

This Table Shows All Connectionstring Properties for the ado.net sqlConnection Object. Most of the Properties Area ALSO Used in ado. All Properties and descriptions is from msdn.

NameDefaultDescriptionApplication Name The name of the application, or '.Net SqlClient Data Provider' if no application name is provided.AttachDBFilename-or-extended properties-or-Initial File Name The name of the primary file, including the full path name, of an attachable database. The database name must be specified with the keyword 'database'.Connect Timeout-or-Connection Timeout15The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.Connection Lifetime0When a connection is returned to the pool, its creation time is compared with the current time, and the connection is destroyed if that time span (in seconds) exceeds the value specified by connection lifetime. Useful in clustered configurations to force load balancing between a running server And A Server Just BROUGHT On-line.connection reset'true'determines WHENER THE DATABASE Connection Is Reset When Removed from The pool. Setting to 'False' Avoids MAK ing an additional server round-trip when obtaining a connection, but the programmer must be aware that the connection state is not being reset.Current Language The SQL Server Language record name.Data Source-or-Server-or-Address-or-Addr -or-Network address The name or network address of the instance of SQL Server to which to connect.Enlist'true'When true, the pooler automatically enlists the connection in the creation thread's current transaction context.Initial Catalog-or-Database The name ORSE 'WRUSTED_CONNECTION' FALSED VALUES ARE 'TRUE', 'FALSE', AND 'SSPI'

, Which is equivalent to 'true'.Max Pool Size100The maximum number of connections allowed in the pool.Min Pool Size0The minimum number of connections allowed in the pool.Network Library-or-Net'dbmssocn'The network library used to establish a connection to an instance of SQL Server. Supported values ​​include dbnmpntw (Named Pipes), dbmsrpcn (Multiprotocol), dbmsadsn (Apple Talk), dbmsgnet (VIA), dbmsipcn (Shared Memory) and dbmsspxn (IPX / SPX), and dbmssocn (TCP / IP). The Corresponding Network DLL Must Be Installed on The System To Which You Connect. If You Use A Local Server (for Example, "), Shared Memory IS Used .Packet Size8192Size in bytes of the network packets used to communicate with an instance of SQL Server.Password-or-Pwd The password for the SQL Server account logging on.Persist Security Info'false'When set to 'false', security-sensitive Information, Such As the Password, IS NOT RETURNED AS Part of the Connection If The Connection is open or has ever been in an open state. Resetting the connection string resets all connection string values ​​including the password.Pooling'true'When true, the SQLConnection object is drawn from the appropriate pool, or if necessary, is created and added to the appropriate pool.User ID The SQL Server login account.Workstation IDthe local computer nameThe name of the workstation connecting to SQL Server Note Use;. to separate each property.If a name occurs more than once, the value from the last one in the Connectionstring Will Be Used.if You Are Building Your Connectionstring In Your App Using Values ​​from User Input Fields, Make Sure The User Can '

T Change The Connectionstring by Inserting An Additional Property with Another Value With User Value.odbc OLE DB, OLEDBCONNECTION (.NET)

Standard security: "driver = {Microsoft Access Driver (* .mdb)}; dbq = c: /mydatabase.mdb; uid = admin; pwd =;" Workgroup: "driver = {microsoft access driver (* .mdb)}; DBQ = C: /MYDATABASE.MDB; SystemDB = C: /MYDATABASE.MDW; "" Admin "," "Exclusive:" Driver = {Microsoft Access Driver (* .mdb)}; dbq = c: /mydatabase.mdb EXCLUSIVE = 1; uid = admin; pwd = "

Standard security: "provider = microsoft.jet.OLEDb.4.0; data source = / somepath / mydb.mdb; user ID = admin; password =;" Workgroup (system database): "provike = microsoft.jet.OleDb.4.0; Data Source = / SomePath / MyDb.mdb; Jet OLEDB: System Database = System.mdw; "," Admin "," "with password:" provike = microsoft.jet.Oledb.4.0; data source = / somepath / mydb. MDB; Jet OLEDB: Database Password = MyDbpassword; "," admin "," "

ODBC OLE DB, OLEDBCONNECTION (.NET) ORACLECONNECTION (.NET) DATA Shape

New version: "Driver = {Microsoft ODBC for Oracle}; Server = OracleServer.world; Uid = Username; Pwd = asdasd;" Old version: "Driver = {Microsoft ODBC Driver for Oracle}; ConnectString = OracleServer.world; Uid = Myusername; PWD = mypassword; "

Standard Security: "provider = msdara; data source = myoracledb; user id = username; password = asdasd;"

This One's from Microsoft, The Following Are from Oracle, THE FLLOWING ARE

Standard Security: "Provider = OraOLEDB.Oracle; Data Source = MyOracleDB; User Id = Username; Password = asdasd;" Trusted Connection: "Provider = OraOLEDB.Oracle; Data Source = MyOracleDB; OSAuthent = 1;" Standard: "Data Source = Oracle8i; integrated security = yes ";

This One Works Only with Oracle 8i Release 3 or Later

Declare the OracleConnection:

C #: using System.Data.OracleClient; OracleConnection oOracleConn = new OracleConnection (); oOracleConn.ConnectionString = "my connectionstring"; oOracleConn.Open (); VB.NET:Imports System.Data.OracleClientDim oOracleConn As OracleConnection = New OracleConnection () Oracleconn.connectionstring = "my connectionstring" oracleconn.open ()

MS Data Shape: "Provider = MSDataShape.1; Persist Security Info = False; Data Provider = MSDara; Data Source = ORAC; User ID = UserName; Password = MYPW"

ODBC OLE DB, OLEDBCONNECTION (.NET) mysqlconnection (.net)

Local Database: "Driver = {mysql}; server = mysrvname; option = 16834; data = mydatabase;" Remote Database: "driver = {mysql}; server = data.domain.com; port = 3306; option = 131072; STMT =; Database = my-database; uid = username; pwd = password; "

Standard: "provider = mysqlprov; data source = mydb; user id = username; password = asdasd;"

EINFODESIGNS.DBPROVIDER: "Data Source = Server; Database = MyDb; user ID = username; password = pwd; command logging = false"

This One is used with einfodesigns dbprovider, an add-on to .net

Declare the mysqlconnection:

C #: using eInfoDesigns.dbProvider.MySqlClient; MySqlConnection oMySqlConn = new MySqlConnection (); oMySqlConn.ConnectionString = "my connectionstring"; oMySqlConn.Open (); VB.NET:Imports eInfoDesigns.dbProvider.MySqlClientDim oMySqlConn As MySqlConnection = New MySqlConnection () omysqlconn.connectionstring = "my connectionstring" omysqlconn.open () ODBC, EasySoft ODBC, INTERSOLV

Local computer: "Driver = {Easysoft IB6 ODBC}; Server = localhost; Database = localhost: C: /mydatabase.gdb; Uid = username; Pwd = password" Remote Computer: "Driver = {Easysoft IB6 ODBC}; Server = ComputerName Database = computername: c: /mydatabase.gdb; uid = username; pwd = password

Read more About this Driver: EasySoft ODBC-InterBase Driver >>

Local computer: "Driver = {INTERSOLV InterBase ODBC Driver (* .gdb)}; Server = localhost; Database = localhost: C: /mydatabase.gdb; Uid = username; Pwd = password" Remote Computer: "Driver = {INTERSOLV InterBase ODBC Driver (* .GDB)}; server = computername; database = computename: c: /mydatabase.gdb; uid = username; pwd = password

This Driver Are Provided by DataDirect Technology >> (Formerly Intersolv)

Read More About Connecting to Interbase In this Borland Developer Network Article http://community.borland.com/Article/0,1410,27152,00.html

OLE DB, OLEDBCONNECTION (.NET) from MS

TCP / IP: "Provider = DB2OLEDB; Network Transport Library = TCPIP; Network Address = XXX.XXX.XXX.XXX; Initial Catalog = MyCtlg; Package Collection = MyPkgCol; Default Schema = Schema; User ID = MyUser; Password = MyPW" APPC: "Provider = DB2OLEDB; APPC Local LU Alias ​​= MyAlias; APPC Remote LU Alias ​​= MyRemote; Initial Catalog = MyCtlg; Package Collection = MyPkgCol; Default Schema = Schema; User ID = MyUser; Password = myPW" ODBC

Standard: "Driver = {SYBASE SYSTEM 11}; Srvr = Aron1; Uid = username; Pwd = password;" Intersolv 3.10: "Driver = {INTERSOLV 3.10 32-BIT Sybase}; Srvr = Aron1; Uid = username; Pwd = password "

ODBC OLE DB

Informix 3.30: "Dsn = ''; Driver = {INFORMIX 3.30 32 BIT}; Host = hostname; Server = myserver; Service = service-name; Protocol = olsoctcp; Database = mydb; UID = username; PWD = myPwd Informix-CLI 2.5: "Driver = {INFORMIX-CLI 2.5 (32 Bit)}; server = myserver; database = mydb; uid = username; pwd = mypwd

IBM Informix Ole DB Provider: "Provider = ifxoledbc.2; password = mypw; user ID = myuser; data source = dbname @ ServerName; persist security info = true"

Access Oracle MySQL Interbase IBM DB2 Sybase Informix

转载请注明原文地址:https://www.9cbs.com/read-21864.html

New Post(0)