Connection string __ database for various databases

Source: Internet
Author: User
Tags odbc ole

First-this method is used in access with the most
strconn = "Driver=microsoft Access DRIVER (*.mdb);D bq=" & Server.MapPath ("Aspfree.mdb")
Set conn = Server.CreateObject ("Adodb.connection")
Conn.Open strconn

The second type-this method is used in SQL Server for more
strconn = "Driver={sql Server};D Escription=sqldemo; server=127.0.0.1; Uid=loginid; Pwd=password;database=database_name
Set conn = Server.CreateObject ("Adodb.connection")
Conn.Open strconn

Third Kind
Strconn= "Driver={microsoftaccessdriver (*.mdb)};D bq=f:/inetpub/wwwroot/somedir/db1.mdb;defaultdir=f:/inetpub/ Wwwroot/somedir;uid=loginid;pwd=password;driverid=25;fil=msaccess "Set conn = Server.CreateObject (" Adodb.connection ")
Conn.Open strconn

Fourth application of system data sources
The following uses a Data Source Name:

Set conn = Server.CreateObject ("Adodb.connection")
Conn.Open "Example"
' This is created in the control Panel using the ' bit ODBC Driver.  If you don ' t know how to setup this is a perfect example on activeserverpages.com and File DSN ' s!

The fifth way to use ODBC data sources is if you have to set up the data source in the Control Panel ODBC
Set rs = Server.CreateObject ("Adodb.recordset")
Rs.Open "Tblname", "DSNname", 3, 3



Reprint http://www.chinaitpower.com/A/2001-11-08/4246.html
---------------------------------------------------------------

Connection strings for various databases

The connection mode is divided into two categories, one is OLE DB and the other is ODBC. Collected for some time, sorted out, welcome to add and revise. Thank you.
Ado. NET way connection and ADO similar, here does not add the collation.

Database connection string:
A.oledb Way:
1.Oracle
Standard connection (Standard security):
"Provider=msdaora;data Source=myoracledb; User Id=username; PASSWORD=ASDASD; "
This is the Microsoft format, and the following is the Oracle format (different provider)
"Provider=oraoledb.oracle;data Source=myoracledb; User Id=username; PASSWORD=ASDASD; "
Note: "Data source=" must be set to the Net8 name according to the appropriate naming method. For example, for local naming, it is an alias in Tnsnames.ora, and for Oracle, it is the NET8 Network service name.
Trust connection (Trusted Connection):
"Provider=oraoledb.oracle;data source=myoracledb;osauthent=1;"
or set the user ID to "/"
"Provider=oraoledb.oracle;data Source=myoracledb; User id=/; password=; "
2.SQL Server
Standard connection (Standard security):
"Provider=sqloledb;data source=aron1;initial catalog=pubs; User Id=sa; PASSWORD=ASDASD; "
Trust connection (Trusted connection):
"Provider=sqloledb;data source=aron1;initial catalog=pubs;integrated Security=sspi;"
(If you are connecting to a specific named instance of SQL Server, use the Data source=servere name/instance Name, but only for SQLServer2000), for example: "Provider=sqloledb;data Source=myservername/myinstancename;initial Catalog=mydatabasename; User Id=myusername; Password=mypassword; "
Pop-up enter username and Password dialog box when connecting:
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, the end of Data source is the port number that needs to be used (default is 1433))
3.Access
Standard connection (Standard security):
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=/somepath/mydb.mdb; User id=admin; password=; "
Group connections (System database)
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=/somepath/mydb.mdb; Jet Oledb:system database=system.mdw; "," admin "," "
Connection with Password:
"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 and can also be used 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 Connection (Standa

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.