Connection strings of major databases

Source: Internet
Author: User
Tags dbase interbase
The connection strings of major databases divide the connection methods into two categories: OLEDB and ODBC. Collected for a period of time and sorted it out. You are welcome to add and correct it. Thank you. The connection of ADO. NET is similar to that of ADO. Database connection string: *** A. OLEDB mode: 1. Oracle standard connection (StandardSecurity)

The connection strings of major databases divide the connection methods into two categories: OLEDB and ODBC. Collected for a period of time and sorted it out. You are welcome to add and correct it. Thank you. The connection of ADO. NET is similar to that of ADO. Database connection string: *** A. OLEDB mode: 1. Oracle Standard Security)

Connection strings of major databases


There are two types of Connection Methods: OLEDB and ODBC. Collected for a period of time and sorted it out. You are welcome to add and correct it. Thank you.
The connection of ADO. NET is similar to that of ADO.

Database connection string:

* *** A. OLEDB method: 1. Oracle

Standard Security ):
"Provider = msdaora; Data Source = MyOracleDB; User Id = UserName; Password = asdasd ;"
This is the Microsoft format. The following is the Oracle format (different providers)
"Provider = OraOLEDB. Oracle; Data Source = MyOracleDB; UserId = Username; Password = asdasd ;"
Note: "Data Source =" must be set to the Net8 name based on the corresponding naming method. For example, for a local name, it is an alias in tnsnames. ora. For an Oracle name, it is a Net8 network service name.
Trusted Connection ):
"Provider = OraOLEDB. Oracle; Data Source = MyOracleDB; OSAuthent = 1 ;"
Or set the user ID "/"
"Provider = OraOLEDB. Oracle; Data Source = MyOracleDB; User Id =/; Password = ;"

2. SQL Server

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 ;"
(If you connect to a specific named SQLServer Instance, use Data Source = Servere Name/Instance Name; but only applicable to SQLServer2000) Example: "Provider = sqloledb; data Source = MyServerName/MyInstanceName; Initial Catalog = MyDatabaseName; User Id = MyUsername; Password = MyPassword ;"
The enter user name and password dialog box is displayed during connection:
Conn. Provider = "sqloledb"
Conn. Properties ("Prompt") = adPromptAlways
Conn. Open "Data Source = Aron1; Initial Catalog = pubs ;"
Connect by IP Address:
"Provider = sqloledb; Data Source = 190.190.200.100, 1433; Network Library = DBMSSOCN; Initial Catalog = pubs; UserID = sa; Password = asdasd ;"
(DBMSSOCN = TCP/IP replaces Named Pipes, and the end of Data Source is the port number to be used (default: 1433 ))

3. Access

Standard Security ):
"Provider = Microsoft. Jet. OLEDB.4.0; Data Source =/somepath/mydb. mdb; User Id = admin; Password = ;"
Group connection (System database)
"Provider = Microsoft. Jet. OLEDB.4.0; Data Source =/somepath/mydb. mdb; Jet OLEDB: System Database = system. mdw;", "admin ",""
Password-based connection:
"Provider = Microsoft. Jet. OLEDB.4.0; Data Source =/somepath/mydb. mdb; Jet OLEDB: Database Password = MyDbPassword;", "admin ",""

4. MySQL

Standard connection:
"Provider = MySQLProv; Data Source = mydb; User Id = UserName; Password = asdasd ;"
Data Source is the name of the MySQL database. You can also use server = localhost; DB = test

5. 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"
AS400
"Provider = IBMDA400; Data source = myAS400; User Id = myUsername; Password = myPassword ;"

6. Excel

Standard Security ):
"Provider = Microsoft. Jet. OLEDB.4.0; Data Source = C:/DatabasePath/DBSpreadSheet.xls; Extended Properties =/"/"Excel 8.0; HDR = Yes ;/"/";"
NOTE: If "HDR = Yes", the provider will not include the first row selected in the record set. If so, the provider will include the unit range (or has been named) in the record set) the first line

7.txt(.csv,. txt,. tab)

"Provider = Microsoft. jet. OLEDB.4.0; Data Source = C:/DatabasePath/; Extended Properties =/"/" text; "HDR = Yes; FMT = Delimited ;/"/";"
Note that when writing an SQL statement, you must specify the file Name (for example, "Select Name, Address From Clients.txt ").

8. VFP (. dbc,. dbf)

Standard connection:
"Provider = vfpoledb; Data Source = C:/DatabasePath/MyDatabase. dbc ;"
Or
"Provider = VFPOLEDB.1; Data Source = d:/temp; Password =" "; Collating Sequence = MACHINE"

9. Interbase

Standard connection:
"Provider = sibprovider; location = localhost:; data source = c:/databases/gdbs/mygdb. gdb; user id = SYSDBA; password = masterkey"
Specified character set:
"Provider = sibprovider; location = localhost:; data source = c:/databases/gdbs/mygdb. gdb; user id = SYSDBA; password = masterkey; character set = ISO8859_1"
Specified role:
"Provider = sibprovider; location = localhost:; data source = c:/databases/gdbs/mygdb. gdb; user id = SYSDBA; password = masterkey; role = DIGITADORES"
"To learn more, please link to Interbase's following Borland Developer Web Article http://community.borland.com/article/0,1410,27152,00.html

10. Sybase

Adaptive Server Anywhere (ASA ):
"Provider = ASAProv; Data source = myASA"
Adaptive Server Enterprise (ASE) (with the data source as the. IDS file ):
"Provider = Sybase ase ole db Provider; Data source = myASE"
Note that you must use the data manager to create a data source. IDS file. These. IDS files are similar to ODBC DSNs.
Supplement:

Outlook 2000 personal mail box

"Provider = Microsoft. Jet. OLEDB.4.0; Outlook 9.0; MAPILEVEL =; DATABASE = C:/Temp /;"
Use any Temporary Folder instead of c:/temp. This will create a pattern file in that folder. When you open it, it will display all the available fields. An empty mapilevel indicates the folder at the highest level.

Exchange mail box

"Provider = Microsoft. Jet. OLEDB.4.0; Exchange 4.0; MAPILEVEL = Mailbox-Pat Smith login DATABASE = C:/Temp /;"
Use any Temporary Folder instead of c:/temp.
Note: You can enter and query the mail store like a database.
Example: "SQL" SELECT Contacts. * FROM Contacts ;"

* *** B. ODBC: 1. Oracle

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

2. SQL Server

Standard Security ):
DRIVER = SQL Server; SERVER = computer name or IP address; UID = user name; PWD = password; APP = Microsoft Visual FoxPro; WSID = computer name or IP address; DATABASE = DATABASE Name & complete connection string: pipe naming method
DRIVER = SQL Server; SERVER = computer name or IP address; UID = user name; PWD = password; DATABASE = DATABASE Name & connection string: pipe naming method

DRIVER = SQL Server; SERVER = computer name or IP address; UID = user name; PWD = password; APP = Microsoft Visual FoxPro; WSID = computer name or IP address; DATABASE = DATABASE name; network = DBMSSOCN; Address = computer name or IP Address, 1433 & complete connection string: & TCP/IP Mode
DRIVER = SQL Server; SERVER = computer name or IP Address; UID = user name; PWD = password; DATABASE = DATABASE name; Network = DBMSSOCN; Address = computer name or IP Address, 1433 & connection string: & TCP/IP Method

"Driver = {SQL Server}; Server = Aron1; Database = pubs; Uid = sa; Pwd = asdasd ;"
1) when the Server is local, the Server can use (local );
"Driver = {SQL Server}; Server = (local); Database = pubs; Uid = sa; Pwd = asdasd ;"
2) When connecting to a remote server, you must specify the address, port number, and network library.
"Driver = {SQL Server}; Server = 130.120.110.001; Address = 130.120.110.001, 1052; Network = dbmssocn; Database = pubs; Uid = sa; Pwd = asdasd ;"
Note: The Address parameter must be an IP Address and must contain the port number.
Trusted connection: (Microsoft Windows NT integrates security)
"Driver = {SQL Server}; Server = Aron1; Database = pubs; Trusted_Connection = yes ;"
Or
"Driver = {SQL Server}; Server = Aron1; Database = pubs; Uid =; Pwd = ;"
The enter user name and password dialog box is displayed during connection:
Conn. Properties ("Prompt") = adPromptAlways
Conn. Open "Driver = {SQL Server}; Server = Aron1; DataBase = pubs ;"

3. Access

Standard Security ):
"Driver = {Microsoft Access Driver (*. mdb)}; Dbq = C:/mydatabase. mdb; Uid = Admin; Pwd = ;"
Workgroup ):
You can specify the user name and password in the connection string or in the dataset.
"Driver = {Microsoft Access Driver (*. mdb)}; Dbq = C:/mydatabase. mdb; SystemDB = C:/mydatabase. mdw; "," admin "," "or
If (pDB. open ("Driver = {Microsoft Access Driver (*. mdb)}; Dbq = C:/mydatabase. mdb; SystemDB = C:/mydatabase. mdw; "," "," DatabaseUser "," DatabasePass "))
{DoSomething (); pDB. Close ();}
Exclusive ):
"Driver = {Microsoft Access Driver (*. mdb)}; Dbq = C:/mydatabase. mdb; Exclusive = 1; Uid = admin; Pwd ="

4. MySQL

Local Database:
"Driver = {mySQL}; Server = mySrvName; Option = 16834; Database = mydatabase ;"
The Sever parameter can also use localhost as its value.
Remote database:
"Driver = {mySQL}; Server = data.domain.com; Port = 3306; Option = 131072; Stmt =; Database = my-database; Uid = username; Pwd = password ;"
Meaning of Option value
1. The client cannot handle the case where MyODBC returns a column of true width.
2. The client cannot handle the actual values of the affected rows returned by MySQL.
If this flag is set, MySQL returns 'found rows '. MySQL 3.21.14 or later
4. Generate a debugging log in c:/myodbc. log. This is the same as setting MYSQL_DEBUG = d: t: O, c:/myodbc. log in 'autoexec. bat '.
8. No package restrictions are set for results and parameters.
16. Do not make the drive pop-up problem
32. Use or remove dynamic cursors. This is not allowed in MyODBC 2.50.
64 ignore the use of database names in 'database. table. column'
128 force ODBC manager cursor
256 remove the use of extended values (fetch)
512 full char field full length
1024 SQLDescribeCol () function returns a column name that fully meets the conditions
2048 use the compressed server/client Protocol
4096 tell the server after the function and '(ignore spaces before' (required by PowerBuilder ). This generates all function name keywords.
8192 use a named pipe to connect to the Mysqld server running on NT
16384 change the LONGLONG column to the INTl column (some applications cannot process the LONGLONG column)
32768 return 'user' from SQLTables as Table_qualifier and Table_owner
66536 read parameters from the client and read ODBC groups from 'my. cnf'
131072 add some additional security checks

5. DB2

AS400
"Driver = {Client Access ODBC Driver (32-bit)}; System = myAS400; Uid = myUsername; Pwd = myPassword"

6. Excel

Standard Security ):
"Driver = {Microsoft Excel Driver (*. xls)}; DriverId = 790; Dbq = C:/DatabasePath/DBSpreadSheet.xls; DefaultDir = c:/databasepath ;"

7.txt(.csv,. txt,. tab)

"Driver = {Microsoft Text Driver (*. txt; *. csv)}; Dbq = C:/DatabasePath/; Extensions = asc, csv, tab, txt ;"
If a text file uses tab as the separator, you must create the schema. ini file and use the Format = TabDelimited option in the connection string.
Note: You must specify the file Name (for example, "Select Name, Address From Clients.csv") in the SQL statement ")

8. VFP (. dbc,. dbf)

DBASE:
"Driver = {Microsoft dBASE Driver (*. dbf)}; DriverID = 277; Dbq = c:/DatabasePath"
Note: When writing an SQL statement, you must specify the file Name (for example, "Select Name, Address From Clients. dbf ").
Visual Foxpro (with database containers ):
"Driver = {Microsoft Visual Foxpro Driver}; UID =; SourceType = DBC; SourceDB = C:/DatabasePath/MyDatabase. dbc; Exclusive = No"
Visual Foxpro (no database container ):
"Driver = {Microsoft Visual Foxpro Driver}; UID =; SourceType = DBF; SourceDB = C:/DbfPath/MyDdbf. dbf; Exclusive = No"

Driver = {Microsoft Visual FoxproDriver };
SourceType = DBF; SourceDB = // 192.168.0.1/temp;
Exclusive = No; Collate = Machine; NULL = NO; DELETED = NO; BACKGROUNDFETCH = NO"

9. Interbase

ODBC, Easysoft
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"
"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 InterBase ODBC Driver (*. gdb)}; Server = ComputerName; Database = ComputerName: C:/mydatabase. gdb; Uid = username; Pwd = password"
This drive is now provided by DataDirect Technologies (previously provided by Intersolv)

10. Sybase

Sybase System 12 (or 12.5) Enterprise Open Client standard connection:
"Driver = {sybase ase odbc Driver}; Srvr = Aron1; Uid = username; Pwd = password"
Sybase System 11 standard connection:
"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 ;"
Sybase SQL Anywhere (previously Watcom SQL ODBC driver ):
"ODBC; Driver = Sybase SQL Anywhere 5.0; DefaultDir = c:/dbfolder/; Dbf = c:/mydatabase. db; Uid = username; Pwd = password; Dsn = """""
Note: For double quotation marks (VB syntax) that are referenced with the DSN parameter at the end, you must change the referenced symbol syntax specified by your language. It is actually very important to leave the DSN parameter empty. If it is not included, the 7778 error will occur.


Source: http://www.cnblogs.com/cailinaaa/archive/2009/01/12/1373932.html

Related Article

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.