Connect the string of the database

zhaozj2021-02-16  56

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; user ID = 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; user ID = sa; password = asdasd;"

- OR -

"Server = aron1; database = pubs; user ID = 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 = dbmsoCN; Initial catalog = pubs; user ID = 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 "Province = MSDataShape; Data Provider = Sqloledb; Data Source = aron1; initial catalog = pubs; user ID = sa; password = asdasd;"

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 = msdaora; data source = myoracledb; user id = username; password = asdasd;"

This One's from Microsoft, The Following Are from Oracle, THE FLLOWING ARE

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

Specifying Username and Password:

"Data Source = Oracle8i; user ID = username; password = passwd; integrated security = no;"

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" Data Shape

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

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:

"Data Source = Server; Database = MYDB; User ID = Username; Password = PWD; Command logging = false"

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

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 "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 = computename: c: /mydatabase.gdb; uid = username; pwd = password

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; user ID = sysdba; password = masterkey; role = digitadores

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"

ODBC

STANDARD:

"driver = {IBM DB2 ODBC Driver}; Database = mydbname; hostname = myservername; port = myportnum; protocol = tcpip; uid = myusername; pwd = mypwd"

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 = {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 (FORMER WATCOM SQL ODBC DRIVER):

"ODBC; driver = sybase sql anywhere 5.0; defaultdir = c: / dbfaulter /; 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 .

OLE DB

Adaptive Server Anywhere (ASA):

"Provider = asaprov; data source = myasa"

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

"Provider = Sybase ASE OLE DB Provider; Data Source = Myase" Note That You Must Create A Data Source .ids File Using The Sybase Data Administrator. The Syse .ids Files Resemble ODBC DSNS.

Adaptive Server Enterprise (ASE):

"Provider = sybase.AseoledbProvider; SRVR = MyaseServer, 5000; Catalog = MyDBName; user ID = 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; user ID = username; password = password"

This One Works Only from Open Client 12.5 WHERE The Server Port Number Feature Works, Ambig Llowing Fully Qualified Connection Strings To Be Used without Defining Ny .ids Data Source Files.

AseConnection (.NET)

STANDARD:

"Data Source = 'MyaseServer'; port = 5000; database = 'mydbname'; uid = 'username'; pwd = 'password';"

Declare the aseconnection:

C #: use sybase.data.Aseclient; agent ;; aseconnection (); Ocon.ConnectionString = "My connection string"; Ocon.Open ();

VB.NET: IIMPORTS System.Data.aseclientdim Ocon As Aseconnection = New AseConnection () Ocon.Connectionstring = "My Connection String" Ocon.Open ()

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"

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 /; extended proties =" "text; hdr = yes; fmt = delimited" ""

"HDR = YES;" INDICES That The First Row Contains ColumnNames, Not DataDBF / 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"

ODBC

Database container (.dbc):

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

Free Table Directory:

"Driver = {Microsoft Visual FoxPro Driver}; SourceType = DBF; SourceDb = C: / MyVfpdbFolder; Exclusive = NO; Collate = Machine;"

"Collate = Machine" is the default setting, for other settings check the

Microsoft Visual FoxPro Site:

Pervasive

ODBC

STANDARD:

"Driver = {Pervasive ODBC Client Interface}; servername = srvname; dbq = @ dbname"

OLE DB

STANDARD:

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

UDL

UDL

UDL:

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

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

New Post(0)