Database connection string

xiaoxiao2021-03-06  112

Database connection string

I am very grateful to CreativePeter (dandruff) this connection address (

http://www.connectionstrings.com/)

SQL Server

ODBC

Standard Security:

"Driver = {SQL Server}; server = aron1; data = 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") = adpromptalways

Oconn.open "driver = {SQL Server}; server = aron1; database = public;"

OLE DB, OLEDBCONNECTION (.NET)

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") = adpromptalways

Oconn.open "Data Source = aron1; initial catalog = public;"

Connect Via An IP Address:

"Provider = SQLOLEDB; DATA SOURCE = 190.190.200.100, 1433; network library = dbmssocn; initial catalog = pubs; userid = 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))

SqlConnection (.NET)

Standard Security:

"Data Source = aron1; initial catalog = pubs; userid = sa; password = asdasd;"

- OR -

"Server = aron1; database = pubs; userid = sa; password = asdasd; trusted_connection = false"

(Booth Connection Strings Products 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 Products 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 = dbmssocn; initial catalog = pubs; userid = 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 #: use system.data.sqlclient; sqlconnection osqlconn = new sqlconnection (); osqlconn.connectionstring = "my connectionstring"; osqlconn ();

VB.Net:imports system.data.sqlclientdim osqlconn as sqlconnection = new sqlconnection () osqlconn.connectionstring = "my connectionstring" osqlconn.open ()

Data Shape

MS Data Shape "provider = msdatashape; data provider = sqloledb; data source = aron1; initial catalog = pubs; userid = sa; password = asdasd;"

Want to Learn Data Shaping? Check Out 4Guyffromrolla's Great Article About Data Shaping >>

Read more

How To Define Wich Network Protocol To Use

EXAMPLE:

"Provider = SQLOLEDB; DATA SOURCE = 190.190.200.100, 1433;

Network library = dbmssocn; initial catalog = pubs; userid = sa; password = asdasd;

Namenetwork librarydbnmpntwwin32 named pipesdbmsoCnwin32 Winsock TCP / IPDBMSSPXNWIN32 SPX / IPXDBMSRPCNWIN32 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 .

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 Withnin The user value.access

ODBC

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;"

Exclusive:

"Driver = {Microsoft Access Driver (* .mdb)}; dbq = c: /mydatabase.mdb; Exclusive = 1; UID = admin; pwd ="

OLE DB, OLEDBCONNECTION (.NET)

Standard Security:

"Provider = microsoft.jet.Oledb.4.0; data source = / somepath / mydb.mdb; user ID = admin; password =;"

Workgroup (System Database):

"Provider = microsoft.jet.Oledb.4.0; data source = / somepath / mydb.mdb; Jet OLEDB: System Database = system.mdw;"

WITH Password:

"Provider = microsoft.jet.Oledb.4.0; data source = / somepath / mydb.mdb; jet oledb: Database password = mydbpassword;"

Oracle

ODBC

New Version:

"Driver = {microsoft odbc for oracle}; server = oracleserver.world; uid = username; pwd = asdasd;"

Old Version:

"Driver = {microsoft odbc driver for oracle}; connectionString = oracleserver.world; uid = myusername; pwd = mypassword;"

OLE DB, OLEDBCONNECTION (.NET)

Standard Security:

"Provider = msdara; data source = myoracledb; userid = username; password = asdasd;"

This One's from Microsoft, The Following Are from Oracle

Standard Security:

"Provider = oraoledb.oracle; data source = myoracledb; user ID = username; password = asdasd;"

Trusted Connection:

"Provider = oraoledb.racle; data source = myoracledb; osauthent = 1;"

OracleConnection (.NET)

STANDARD:

"Data Source = Oracle8i; Integrated Security = YES";

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

Declare the OracleConnection:

C #: use system.data.racleClient; OracleConnection OracleConn = New OracleConnection (); oracleconn.connectionstring = "my connectionstring"; oracleconn.open ();

VB.NET: IIMPORTS System.Data.OracleClientDim Oracleconn As OracleConnection = New OracleConnection () Oracleconn.Connectionstring = "My Connectionstring" oracleconn.open ()

Core Labs ORADIRECT (.NET)

Standard: "User ID = Scott; PASSWORD = Tiger; Host = ORA; POOLING = true; min pool size = 0; Max pool size = 100; connection lifetime = 0"

Read more at

Core lab and the product page.

Data Shape

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

Want to Learn Data Shaping? Check Out 4Guyffromrolla's Great Article About Data Shaping >>

Mysql

ODBC

Local Database:

"Driver = {mysql}; server = mysrvname; option = 16834; Database = mydatabase;"

Remote Database:

"Driver = {mysql}; server = data.domain.com; port = 3306; option = 131072; stmt =; dataBase = my-data; uid = username; pwd = password;"

OLE DB, OLEDBCONNECTION (.NET)

STANDARD:

"Provider = mysqlprov; data source = mydb; user id = username; password = asdasd;"

MySQLConnection (.NET)

EINFODESIGNS.DBPROVIDER: "Datasource = Server; Database = mydb; userid = username; password = pwd; command logging = false"

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

Declare the mysqlconnection:

C #: use 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 ()

SevenObjects mysqlclient (.NET)

STANDARD:

"Host = server; username = myusername; password = mypassword; database = mydb;"

This is a freeware ado.net data provider from SevenObjects

Core labs mysqldirect (.NET)

STANDARD:

"User ID = root; password = pwd; host = localhost; port = 3306; dataBase = test; Direct = true; protocol = tcp; compress = false; pooling = true; min pool size = 0; max pool size = 100; Connection Lifetime = 0 "

Read more at

Core lab and the product page.

Interbase

ODBC, EasySoft

Local Computer:

"Driver = {easysoft IB6 odbc}; server = localhost; database = localhost: c: /mydatabase.gdb; uid = username; pwd = password

Remote computer:

"driver = {easysoftib6odbc}; server = computername; database = computename: c: /mydatabase.gdb; uid = username; pwd = password

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

ODBC, INTERSOLV

Local Computer:

"Driver = {INTERSOLV InterBase ODBC Driver (* .GDB)}; server = localhost; database = localhost: c: /mydatabase.gdb; uid = username; pwd = password" Remote Computer:

"Driver = {INTERSOLV Interbaseodbcdriver (*. GDB)}; server = computername; database = computename: c: /mydatabase.gdb; uid = username; pwd = password

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

OLE DB, SIBPROVIDER

STANDARD:

"provider = sibprovider; location = localhost:; data source = c: /Databases/gdbs/mygdb.gdb; user ID = sysdba; password = masterkey

Specifying Character SET:

"provider = sibprovider; location = localhost:; data source = c: /Databases/gdbs/mygdb.gdb; user ID = sysdba; password = masterkey; character set = iso8859_1

Specifying role:

"provider = sibprovider; location = localhost:; data source = c: /Databases/gdbs/mygdb.gdb; userid = sysdba; password = masterkey; role = digitadores

Read more About SibProvider >>

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

IBM DB2

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"

Sybase

ODBC

Standard Sybase System 12 (or 12.5) Enterprise Open Client: "Driver = {Sybase ASE ODBC DRIVER}; SRVR = aron1; uid = username; pwd = password"

Standard Sybase System 11:

"Driver = {sybasesystem11}; SRVR = aron1; uid = username; pwd = password;"

Do you know a Userguide for Sybase System 11, 12, 12.5? E-mail the url to connectionstrings.com now !! >>

INTERSOLV 3.10:

"Driver = {INTERSOLV 3.10 32-bit Sybase}; SRVR = aron1; uid = username; pwd = password;"

Sybase SQL Anywhere (FORMER WATCOM SQL ODBC DRIVER):

"Odbc; driver = sybasesqlanywhere5.0; defaultdir = c: / dbfolder /; dbf = c: /mydatabase.db; uid = username; pwd = password; dsn =" "" "

Note! The two double quota following the DSN parameter at the end are escaped quotas (VB syntax), you may have to change this to your language specific escape syntax. The empty DSN parameter is indeed critical as not including it will result in error 7778 .

Read more in the Sybase SQL Anywhere User Guide >>

OLE DB

Adaptive Server Anywhere (ASA):

"Provider = asaprov; data source = myasa"

Read more in the asa user guide >>

Adaptive Server Enterprise (ASE) with data source .ids file:

"Provider = Sybase ASE OLE DB Provider; Data Source = Myase"

Note this.

Adaptive Server Enterprise (ASE):

"Provider = Sybase.ASEOLEDBProvider; Srvr = myASEserver, 5000; Catalog = myDBname; UserId = username; Password = password" - some reports on problem using the above one, try the following as an alternative - "Provider = Sybase.ASEOLEDBProvider; Server Name = myASEserver, 5000; Initial Catalog = myDBname; UserId = username; password = password" This one works only from Open Client 12.5 where the server port number feature works, ember llowing fully qualified connection Strings to be used without defining ny .ids data source file.

Informix

ODBC

Informix 3.30:

"DSN = ''; driver = {informix 3.30 32 bit}; host = hostname; service = myserver; service = service-name; protocol = ilSoctcp; 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

OLE DB

IBM Informix Ole DB Provider:

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

Mimer SQL

ODBC

Standard Security:

"Driver = {mimer}; database = mydb; uid = myuser; pwd = mypw;"

Prompt for username and password:

"Driver = {mimer}; Database = mydb;"

PostgreSQL

Core Labs PostgreSqldirect (.NET)

STANDARD:

"User ID = root; password = pwd; host = localhost; port = 5432; dataBase = testdb; pooling = true; min pool size = 0; max pool size = 100; connection lifetime = 0"

Read more at

Core lab and the product page.

DSN

ODBC

DSN:

"DSN = MYDSN; UID = Username; PWD =;"

File DSN:

"Filedsn = c: /mydata.dsn; uid = username; pwd =;" Excel

ODBC

STANDARD:

"Driver = {Microsoft Excel Driver (* .xls)}; driverid = 790; dbq = c: /myexcel.xls; defaultdir = c: / mypath;"

OLE DB

STANDARD:

"Provider = microsoft.jet.Oledb.4.0; data source = c: /myexcel.xls; extended proties =" "Excel 8.0; HDR = YES; IMEX = 1" ""

"HDR = yes;" INDICES That The First Row Contains ColumnNames, Not Data

"IMEX = 1;" TELLS The Driver to Always Read "Intermixed" Data Columns As Text

TIP! SQL SYNTAX: "SELECT *" "- I. Worksheet Name Followed by a" $ "and wrapped in" [""] "brackets.

TEXT

ODBC

STANDARD:

"Driver = {Microsoft text driver (* .txt; * .csv)}; dbq = c: / txtFilesfolder /; extensions = ASC, CSV, Tab, TXT;

OLE DB

Standard:

"provider = microsoft.jet.Oledb.4.0; data source = c: / txtfilesfolder /; extendedproperties =" "text; hdr = yes; fmt = delimited" ""

"HDR = yes;" INDICES That The First Row Contains ColumnNames, Not Data

DBF / FOXPRO

ODBC

STANDARD:

"Driver = {Microsoft DBase Driver (* .dbf)}; driverid = 277; dbq = c: / mydbpath;"

OLE DB, OLEDBCONNECTION (.NET)

STANDARD:

"Provider = microsoft.jet.Oledb.4.0; data source = c: / folder; extended Properties = dbase iv; user ID = admin; password ="

Visual FoxPro

OLE DB, OLEDBCONNECTION (.NET)

Database container (.dbc):

"Provider = vfpoledb.1; data source = c: /mydbfolder/mydbcontainer.dbc; password = mypassword; collating sequence = machine"

Free Table Directory:

"Provider = vfpoledb.1; data source = c: / mydatadirectory /; password = mypassword; collating sequence = general" read more (Microsoft MSDN) >>

ODBC

Database container (.dbc):

"Driver = {Microsoft Visual FoxPro Driver}; SourceType = DBC; SourceDb = C: /MyVFPDB.DBC; Exclusive = NO; Collate = Machine;"

Free Table Directory:

"Driver = {MicrosoftVisualfoxProdriver}; SourceType = DBF; SOURCEDB = C: / MyVFpdbFolder; Exclusive = NO; Collate = Machine;"

"Collate = Machine" is the default setting, for other settings check the list of supported collating sequences >>

Microsoft Visual FoxPro Site: http://msdn.microsoft.com/vfoxpro

Pervasive

ODBC

STANDARD:

"Driver = {pervasive odbc clientinterface}; servername = srvname; dbq = @ DBNAME"

Pervasive ODBC INFO >>

OLE DB

STANDARD:

"Provider = pervasiveoledb; data source = c: / path"

Pervasive OLE DB INFO >>

UDL

UDL

UDL:

"File name = c: /mydataLink.ud;"

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

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.043, SQL: 9