Sunday, August 8, 2010

A variety of ways to access the database connection string Daquan! uggs australia uk

A variety of ways to access the database connection string Daquan! ,uggs australia uk
One data source to access the database using:

If the system data source or user data source:
sqlText = \= user name; pwd = password; \
uid and pwd is optional, were used to set the access to the database user name and password, SQL Server and Oracle and other database, visits need to specify the user name and password, then these two parameters to specify,ugg sale uk, but for Access is not required.

Second, do not directly connect to the database DSN (ODBC mode):

1, visit the Access database:
(1) access to the database are not encrypted:
sqlText = \Access Driver (*. mdb); DBQ = database address; UID =; PWD = database password;) \Microsoft ODBC for Oracle); Server = server name or address; uid = user name; Pwd = password \; Server = server name; Database = Database Name; Uid = username; Pwd = password \; Port = 3306; Option = 131072; Stmt =; Database = Database Name; Uid = username; Pwd = password; \:

1, visit the Access database:
(1) access to the database are not encrypted:
sqlText = \Address; \password; \Microsoft provides:
sqlText = \; Provider = OraOLEDB.Oracle; Data Source = database name; User Id = username; Password = password; \= (SQL Server); Server = server name; Database = Database Name; Uid = username; Pwd = password; \================================================== ======================< br> database connection string (recommended) the database connection string
various applications in database development, connecting to the database is the first step in database application development, but also the most important step. As for their connection to different databases varies, the corresponding connection string is different.
programmer may have the same experience, and sometimes do not know connect to the database connection string needed to write or how often a result of a mistake can not correctly access the database. Of course, many visual programming tools to interface directly through generate the correct connection string, but string the specific meaning of each parameter is not clear and often confused. In this paper, for the most commonly used database lists the different connection methods and the need to illustrate the connection string to the programmer reference!

Sql Server
? ODBC < br> o standard connector (Standard Security):
\Database = pubs; Uid = sa; Pwd = asdasd; \\2) When connecting the remote server, the need to specify the address, port number and network libraries
\= 130.120.110.001,1052; Network = dbmssocn; Database = pubs; Uid = sa; Pwd = asdasd; \must include the port number
o trusted connection (Trusted connection): (Microsoft Windows NT integrated security)
; \; \user name and password dialog box:
Conn.Properties (\\o Standard connection (Standard Security):
\sa; Password = asdasd; \sqloledb; Data Source = Aron1; Initial Catalog = pubs; Integrated Security = SSPI; \Name \ Instance Name; but only SQLServer2000) such as: \; o connection pop-up dialog box enter a user name and password:
Conn.Provider = \Conn.Properties (\o by IP address to connect:
\= DBMSSOCN; Initial Catalog = pubs; User ID = sa; Password = asdasd; \Use the port number (default is 1433))
? SqlConnection (. NET)
o standard connection (Standard Security):
\or
\(both connection strings of the same results)
o trusted connection (Trusted connection):
\\)
(can use serverName \ instanceName instead of Data Source, value for a specific instance of SQLServer,kids ugg boots, but only SQLServer2000)
o by IP address to connect:
\= sa; Password = asdasd; \)
o SqlConnection connection statement:
C #:
using System.Data.SqlClient;
SqlConnection SQLConn = new SqlConnection ();
SQLConn . ConnectionString = \VB.NET:
Imports System.Data.SqlClient
Dim SQLConn As SqlConnection = New SqlConnection ()
SQLConn.ConnectionString = \Open ()
? Data Shape
o MS Data Shape
; \? more
o How to define which protocol to use
§ For example:
; \name of the network protocol library
dbnmpntw Win32 Named Pipes
dbmssocn Win32 Winsock TCP / IP
dbmsspxn Win32 SPX / IPX
dbmsvinn Win32 Banyan Vines
dbmsrpcn Win32 Multi-Protocol (Windows RPC)
§ Important
When connecting through the SQLOLEDB provider use the following syntax:
Network Library = dbmssocn
but provided through MSDASQL connect those who use the following syntax:
Network = dbmssocn
o all the SqlConnection connection string properties
§ The following table shows the ADO.NET SqlConnection connection string properties of all objects. Most of the properties are also used in ADO. all the attributes and description from msdn.
Name Default Description
Application Name application name or when the application does not provide for the. Net SqlClient Data providers
AttachDBFilename or extended properties or Initial File Name The name of key documents, including the full path to the associated database. Database name must keyword 'database' to specify.
Connect Timeout or Connection Timeout 15 in the suspension of the connection request, waiting for the server connection error before the time (in seconds)
; Connection Lifetime 0 When a connection back to connection pool, the current time and the connection to create the time difference, if the time exceeds the connection lifetime specified in this connection will be destroyed. It is used to gather to set the server and ready to run on the line force load balancing between servers.
Connection Reset 'true' removed when the connection from the connection pool when deciding whether to reset the database connection. When set to 'false' when the connection is used to prevent access to the additional cost of the server back and forth.
Current Language SQL Server Language record name
Data Source or Server or Address or Addr or Network Address to connect The SQL Server instance name or network address
Enlist 'true' is true, the connection pool automatically listed in the thread's current transaction context created in the connection.
Initial Catalog or Database database name
Integrated Security or Trusted_Connection 'false' connection is connected to trust. Its value is 'true', 'false' and 'sspi' (equivalent to 'true').
Max Pool Size 100 connection pool to allow the maximum number of connections < br> Min Pool Size 0 The minimum connection pool to allow connections
Network Library or the Net 'dbmssocn' network of libraries used to establish a connection to SQL Server instance. Values include dbnmpntw (named pipes), dbmsrpcn (multi-protocol),ugg outlet store, dbmsadsn (Apple Talk), dbmsgnet (VIA), dbmsipcn (shared memory) and dbmsspxn (IPX / SPX), and dbmssocn (TCP / IP). The connected system must install the appropriate dynamic link library. If you do not specify the network, when you use a local server (for example, \Packet Size 8192 and an instance of SQL Server communication network packet bytes
Password-or Pwd SQL Server account login password
; Persist Security Info 'false' set to 'false', when the connection has been opened or has been in open, sensitive security information (such as passwords) will not return as part of the connection information.
Pooling 'true' is true, remove from the appropriate SQLConnection connection pool object,australia ugg boots sale, or if necessary, create a SQLConnection object and connect it to the appropriate pool.
User ID SQL Server login user
Workstation ID the local computer name to connect to SQL Server workstation name < br> § Note:
use a semicolon to separate each property
If a name appears more than twice, in the connection string in the value of the last occurrence will be used.
If you pass in the application of the values from the user input fields to build the connection string, you must ensure that the user does not by user value into another value inside a additional attributes to change the connection string.
Access
? ODBC
o Standard connection (Standard Security):
\=; \: In the connection string or in the open data set for the specified user name and password
\mdb; SystemDB = C: \ mydatabase.mdw; \if (pDB.Open (\, \();
)
o exclusively (Exclusive):
\;? OLE DB, OleDbConnection (. NET)
o standard connector (Standard Security):
\; o group connection (system database)
\= system.mdw; \; \? Oracle
? ODBC
o the new version:
\; o the old version:
\\br> \; This is Microsoft's format,cheap uggs, the following is the format of Oracle (different providers)
\Password = asdasd; \For example,ugg boots store, the local name for it is an alias in tnsnames.ora, the Oracle name, it is the Net8 service name
o trust network connection (Trusted Connection):
\as \;? OracleConnection (. NET)
o standard connection:
\; Data Source = Oracle8i; Integrated Security = yes \o OracleConnection statement:
C #:
using System.Data.OracleClient;
OracleConnection OracleConn = new OracleConnection ();
OracleConn.ConnectionString = \OracleConn.Open ();



相关的主题文章:

No comments:

Post a Comment