Database connection string conn. Open connstr set)

Source: Internet
Author: User
Tags dsn ibm db2 informix interbase oracleconnection sybase

1. sqlserver
A. ODBC
I. Standard Security:
"Driver = {SQL Server}; server = aron1; database = pubs; uid = sa; Pwd = asdasd ;"
Ii. trusted connection:
"Driver = {SQL Server}; server = aron1; database = pubs;
Trusted_connection = yes ;"
Iii. Prompt for username and password:
Oconn. properties ("prompt") = adpromptalways
Oconn. Open "driver = {SQL Server}; server = aron1; database = pubs ;"
B. OLE DB, oledbconnection (. NET)
I. Standard Security:
"Provider = sqloledb; Data Source = aron1; initial catalog = pubs; User
Id = sa; Password = asdasd ;"
Ii. trusted connection:
"Provider = sqloledb; Data Source = aron1; initial catalog = pubs;
Integrated Security = sspi ;"
(Only applicable to sqlserver 2000)
Iii. Prompt for username and password:
Oconn. provider = "sqloledb"
Oconn. properties ("prompt") = adpromptalways
Oconn. Open "Data Source = aron1; initial catalog = pubs ;"
Iv. Connect via an IP Address:
"Provider = sqloledb; Data Source = 190.190.200.100, 1433; Network
Library = dbmssocn; initial catalog = pubs; user id = sa; Password = asdasd ;"
C. sqlconnection (. NET)
I. Standard Security:
"Data Source = aron1; initial catalog = pubs; user id = sa; Password = asdasd ;"
Or "Server = aron1; database = pubs; user id = sa; Password = asdasd;
Trusted_connection = false"
Ii. trusted connection:
"Data Source = aron1; initial catalog = pubs; Integrated Security = sspi ;"
Or "Server = aron1; database = pubs; trusted_connection = true ;"
(Only applicable to sqlserver 2000)
Iii. Connect via an IP Address:
"Data Source = maid, 1433; network library = dbmssocn; initial
Catalog = pubs; user id = sa; Password = asdasd ;"
Name Network Library
Dbnmpntw Win32 Named Pipes
Dbmssocn Win32 Winsock TCP/IP
Dbmsspxn Win32 SPX/IPX
Dbmsvinn Win32 Banyan vines
Dbmsrpcn Win32 Multi-Protocol (Windows RPC)
Connect through sqloledb provider, use network library = dbmssocn, and use msdasql
Provider connection, using network = dbmssocn
Iv. Declaration method:
C #:
Using system. Data. sqlclient;
Sqlconnection osqlconn = new sqlconnection ();
Osqlconn. connectionstring = "My connectionstring ";
Osqlconn. open ();
VB. NET:
Imports system. Data. sqlclient
Dim osqlconn as sqlconnection = new sqlconnection ()
Osqlconn. connectionstring = "My connectionstring"
Osqlconn. open ()
D. Data shape
MS data shape
"Provider = msdatashape; data provider = sqloledb; Data Source = aron1; initial
Catalog = pubs; user id = sa; Password = asdasd ;"
Haha, data shape has never been used. Please refer
Http://www.4guysfromrolla.com/webtech/092599-1.shtml
2. Access
A. ODBC
I. Standard Security:
"Driver = {Microsoft Access Driver (*. mdb)}; DBQ = c: \ mydatabase. mdb;
Uid = admin; Pwd = ;"
Ii. Workgroup:
"Driver = {Microsoft Access Driver (*. mdb)}; DBQ = c: \ mydatabase. mdb;
Systemdb = c: \ mydatabase. MDW ;"
Iii. Exclusive:
"Driver = {Microsoft Access Driver (*. mdb)}; DBQ = c: \ mydatabase. mdb;
Exclusive = 1; uid = admin; Pwd ="
B. OLE DB, oledbconnection (. NET)
I. Standard Security:
"Provider = Microsoft. Jet. oledb.4.0; Data Source = \ somepath \ mydb. mdb;
User ID = admin; Password = ;"
Ii. Workgroup (System Database ):
"Provider = Microsoft. Jet. oledb.4.0; Data Source = \ somepath \ mydb. mdb;
Jet oledb: System database = system. MDW ;"
Iii. With password:
"Provider = Microsoft. Jet. oledb.4.0; Data Source = \ somepath \ mydb. mdb;
Jet oledb: Database Password = mydbpassword ;"

 

(Additional: "provider = Microsoft. Jet. oledb.4.0; persist Security info = false; Data Source =" & mydbpath)

Open with Password

"Provider = Microsoft. Jet. oledb.4.0; Data Source = c: \ 1.mdb; user id = admin; Password =; Jet oledb: Database Password = 1"

Open User Group

"Provider = Microsoft. jet. oledb.4.0; Data Source = c: \ 1.mdb; user id = admin; Password = RR; Jet oledb: Database Password = 1; Jet oledb: System database = c: \ system. MDW"

Enable LAN sharing

"Provider = Microsoft. jet. oledb.4.0; Data Source =\\ access911 \ floder1 \ 1.mdb; user id = 'admin'; Password = 'rr '; Jet oledb: Database Password = '1'; Jet oledb: system database =\\ access911 \ floder1 \ system. MDW"

 

Jetoledb: globalpartialbulkops = 2; jetoledb: registrypath =; jetoledb: databaselockingmode = 1; jetoledb: databasepassword =; datasource = D: \ dB. MDB; Password =; jetoledb: enginetype = 5; jetoledb: globalbulktransactions = 1; provider = Microsoft. jet. oledb.4.0; jetoledb: systemdatabase =; jetoledb: SFP = false; extendedproperties =; mode = sharedenynone; jetoledb: Rule =; jetoledb: createsystemdatabase = false; jetoledb: Don 'rule = false; jetoledb: compactwithoutreplicarepair = false; userid = admin; jetoledb: encryptdatabase = false

 

2007:

Provider = Microsoft. ace. oledb.12.0; user id = admin; Data Source = c: \ Documents and Settings \ chenge \ My Documents \ database 1. accdb; mode = share deny read | share deny write; extended properties = ""; Jet oledb: System database = c: \ Documents ents and Settings \ chenge \ Application
Data \ Microsoft \ access \ system. MDW; Jet oledb: Registry Path = SOFTWARE \ Microsoft \ Office \ 12.0 \ access connectivity engine; Jet oledb: Database Password = ""; Jet oledb: Engine type = 6; jet oledb: Database locking mode = 0; Jet oledb: Global partial bulk Ops = 2; Jet oledb: Global
Bulk transactions = 1; Jet oledb: New Database Password = ""; Jet oledb: Create System database = false; Jet oledb: encrypt database = false; Jet oledb: don't copy locale on compact = false; Jet oledb: compact without replica repair = false; Jet oledb: SFP = false; Jet oledb: Support
Complex data = true
3. Oracle
A. ODBC
I. New Version:
"Driver = {Microsoft ODBC for Oracle}; server = oracleserver. World;
Uid = username; Pwd = asdasd ;"
Ii. Old Version:
"Driver = {Microsoft ODBC driver for Oracle}; connectstring =
Oracleserver. World; uid = myusername; Pwd = mypassword ;"
B. OLE DB, oledbconnection (. NET)
I. Standard Security:
"Provider = msdaora; Data Source = myoracledb; user id = username;
Password = asdasd ;"
Note: The above is the MS driver, and the following is the driver provided by Oracle:
"Provider = oraoledb. Oracle; Data Source = myoracledb; User
Id = username; Password = asdasd ;"
Ii. trusted connection:
"Provider = oraoledb. Oracle; Data Source = myoracledb; osauthent = 1 ;"
C. oracleconnection (. NET)
I. Standard:
"Data Source = Oracle8i; Integrated Security = yes ";
Note: This statement is used in Oracle 8i Release 3 and later versions.
Declaration method:
C #:
Using system. Data. oracleclient;
Oracleconnection ooracleconn = new oracleconnection ();
Ooracleconn. connectionstring = "My connectionstring ";
Ooracleconn. open ();
VB. NET:
Imports system. Data. oracleclient
Dim ooracleconn as oracleconnection = new oracleconnection ()
Ooracleconn. connectionstring = "My connectionstring"
Ooracleconn. open ()
D. Data shape
I. MS data shape:
"Provider = msdatashape.1; persist Security info = false; Data
Provider = msdaora; Data Source = Orac; user id = username; Password = mypw"
3. MySQL
A. ODBC
I. Local Database:
"Driver = {MySQL}; server = mysrvname; option = 16834; database = mydatabase ;"
Ii. Remote database:
"Driver = {MySQL}; server = data.domain.com; Port = 3306; option = 131072;
Stmt =; database = My-database; uid = username; Pwd = password ;"
B. OLE DB, oledbconnection (. NET)
I. Standard:
"Provider = mysqlprov; Data Source = mydb; user id = username;
Password = asdasd ;"
C. mysqlconnection (. NET)
I. einfodesigns. dbprovider:
"Data Source = server; database = mydb; user id = username;
Password = PWD; command logging = false"
Note: This method is only used to connect through einfodesigns dbprovider:
Ii. Declaration method:
C #:
Using einfodesigns. dbprovider. mysqlclient;
Mysqlconnection omysqlconn = new mysqlconnection ();
Omysqlconn. connectionstring = "My connectionstring ";
Omysqlconn. open ();
VB. NET:
Imports einfodesigns. dbprovider. mysqlclient
Dim omysqlconn as mysqlconnection = new mysqlconnection ()
Omysqlconn. connectionstring = "My connectionstring"
Omysqlconn. open ()
4. InterBase
A. ODBC (easysoft ODBC-Interbase driver)
I. Local Computer:
"Driver = {easysoft ib6 ODBC}; server = localhost; database = localhost:
C: \ mydatabase. GDB; uid = username; Pwd = password"
Ii. Remote Computer:
"Driver = {easysoft ib6 ODBC}; server = computername; database = computername
: C: \ mydatabase. GDB; uid = username; Pwd = password"
B. ODBC (intersolv ODBC-Interbase driver)
I. Local Computer:
"Driver = {intersolv Interbase ODBC driver (*. GDB)}; server = localhost;
Database = localhost: C: \ mydatabase. GDB; uid = username; Pwd = password"
Ii. Remote Computer:
"Driver = {intersolv Interbase ODBC driver (*. GDB )};
Server = computername; database = computername: C: \ mydatabase. GDB;
Uid = username; Pwd = password"
C. ole db (sibprovider driver)
I. Standard:
"Provider = sibprovider; location = localhost:; Data Source = C:
\ Databases \ gdbs \ mygdb. GDB; user id = sysdba; Password = masterkey"
Ii. Specifying character set:
"Provider = sibprovider; location = localhost:; Data Source = C:
\ Databases \ gdbs \ mygdb. GDB; user id = sysdba; Password = masterkey;
Character Set = iso8859_1"
Iii. Specifying role:
"Provider = sibprovider; location = localhost:; Data Source = C:
\ Databases \ gdbs \ mygdb. GDB; user id = sysdba; Password = masterkey;
Role = digitadores"
6. IBM DB2
A. ole db, oledbconnection (. NET) from MS
I. TCP/IP:
"Provider = db2oledb; network transport library = TCPIP; Network
Address = XXX. XXX; initial catalog = myctlg; Package
Collection = mypkgcol; default schema = Schema; user id = myuser; Password = mypw"
Ii. 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"
7. Sybase
A. ODBC
I. Standard sybase system 12 (or 12.5) Enterprise open client:
"Driver = {Sybase ase odbc driver}; srvr = aron1; uid = username; Pwd = password"
Ii. Standard sybase system 11:
"Driver = {sybase system 11}; srvr = aron1; uid = username; Pwd = password ;"
Iii. intersolv 3.10:
"Driver = {intersolv 3.10 32-bit Sybase}; srvr = aron1; uid = username;
Pwd = password ;"
Iiii. Sybase SQL Anywhere (former Watcom SQL ODBC driver ):
"ODBC; driver = Sybase SQL Anywhere 5.0; defaultdir = c: \ dbfolder \; DBF =
C: \ mydatabase. DB; uid = username; Pwd = password; DSN = """""
B. oledb
I. Adaptive Server Anywhere (ASA ):
"Provider = asaprov; Data Source = myasa"
Ii. Adaptive Server Enterprise (ASE) with data source. IDS file:
"Provider = Sybase ase ole db provider; Data Source = myase"
Note: you must first use data administrator to create data source. IDS file.
Iii. Adaptive Server Enterprise (ASE ):
"Provider = Sybase. aseoledbprovider; srvr = myaseserver, 5000; Catalog = mydbname;
User ID = username; Password = password"
8. Informix
A. ODBC
I. 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
Ii. Informix-cli 2.5:
"Driver = {Informix-cli 2.5 (32 bit)}; server = myserver; database = mydb;
Uid = username; Pwd = mypwd"
B. OLE DB
I. IBM Informix OLE DB Provider:
"Provider = ifxoledbc.2; Password = mypw; user id = myuser; Data Source =
Dbname @ servername; persist Security info = true"
9. Mimer SQL
A. ODBC
I. Standard Security:
"Driver = {Mimer}; database = mydb; uid = myuser; Pwd = mypw ;"
Ii. Prompt for username and password:
"Driver = {Mimer}; database = mydb ;"
10. DSN
A. ODBC
I. DSN:
"DSN = mydsn; uid = username; Pwd = ;"
Ii. File DSN:
"Filedsn = c: \ mydata. DSN; uid = username; Pwd = ;"
11. Excel
A. ODBC
I. Standard:
"Driver = {Microsoft Excel Driver (*. xls)}; driverid = 790;
DBQ = c: \ myexcel.xls; defaultdir = c: \ mypath ;"
B. OLE DB
I. Standard:
"Provider = Microsoft. Jet. oledb.4.0; Data Source = c: \ myexcel.xls; extended
Properties = "" Excel 8.0; HDR = yes; IMEX = 1 """
"HDR = yes;" indicates that the first row contains columnnames, not data.
"IMEX = 1;" tells the driver to alway

 

Create a. udl file and open it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.