数据库连接字符串大全
来源:互联网 发布:创意文案 知乎 编辑:程序博客网 时间:2024/05/03 12:24
数据库连接字符串大全
Oracle
ODBC
New version:
"Driver={MicrosoftODBC for Oracle};Server=OracleServer.world;Uid=Username;Pwd=asdasd;"
Old version:
"Driver={MicrosoftODBC Driver for Oracle}; ConnectString=OracleServer.world;Uid=myUsername;Pwd=myPassword;"
OLE DB, OleDbConnection (.NET)
Standard security:
"Provider=msdaora;DataSource=MyOracleDB;User Id=UserName;Password=asdasd;"
Thisone's from Microsoft, the following are from Oracle
Standard Security:
"Provider=OraOLEDB.Oracle;DataSource=MyOracleDB;User Id=Username;Password=asdasd;"
Trusted Connection:
"Provider=OraOLEDB.Oracle;DataSource=MyOracleDB;OSAuthent=1;"
OracleConnection (.NET)
Standard:
"DataSource=MyOracleDB;Integrated Security=yes;"
This oneworks only with Oracle 8i release 3 or later
Specifying username and password:
"DataSource=MyOracleDB;User Id=username;Password=passwd;IntegratedSecurity=no;"
This oneworks only with Oracle 8i release 3 or later
Declare the OracleConnection:
C#:
usingSystem.Data.OracleClient;
OracleConnectionoOracleConn = new OracleConnection();
oOracleConn.ConnectionString= "my connection string";
oOracleConn.Open();
VB.NET:
ImportsSystem.Data.OracleClient
DimoOracleConn As OracleConnection = New OracleConnection()
oOracleConn.ConnectionString= "my connection string"
oOracleConn.Open()
Missingthe System.Data.OracleClient namespace? Download .NET Managed Provider forOracle >>
Greatarticle! "Features of Oracle Data Provider for .NET" by Rama Mohan G.at C# Corner
Core Labs OraDirect (.NET)
Standard:
"UserID=scott; Password=tiger; Host=ora; Pooling=true; Min Pool Size=0;Max PoolSize=100; Connection Lifetime=0"
Read moreat Core Lab and the product page.
Data Shape
MS Data Shape:
"Provider=MSDataShape.1;PersistSecurity Info=False;Data Provider=MSDAORA;Data Source=orac;userid=username;password=mypw"
Want tolearn data shaping? Check out 4GuyfFromRolla's great article about Data Shaping>>
SQL Server
ODBC
Standard Security:
"Driver={SQLServer};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;"
Trusted connection:
"Driver={SQLServer};Server=Aron1;Database=pubs;Trusted_Connection=yes;"
PRompt for username and passWord:
oConn.Properties("Prompt")= adPromptAlways
oConn.Open"Driver={SQL Server};Server=Aron1;DataBase=pubs;"
OLE DB, OleDbConnection (.NET)
Standard Security:
"Provider=sqloledb;DataSource=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
Trusted Connection:
"Provider=sqloledb;DataSource=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
(useserverName/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=pubs;"
Connect via an ip address:
"Provider=sqloledb;DataSource=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;UserID=sa;Password=asdasd;"
(DBMSSOCN=TCP/IPinstead of Named Pipes, at the end of the Data Source is the port to use (1433is the default))
SqlConnection (.NET)
Standard Security:
"DataSource=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
- or -
"Server=Aron1;Database=pubs;UserID=sa;Password=asdasd;Trusted_Connection=False"
(both connection strings produces the sameresult)
Trusted Connection:
"DataSource=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
- or -
"Server=Aron1;Database=pubs;Trusted_Connection=True;"
(both connection strings produces the sameresult)
(useserverName/instanceName as Data Source to use an specifik SQLServer instance,only SQLServer2000)
Connect via an IP address:
"DataSource=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;UserID=sa;Password=asdasd;"
(DBMSSOCN=TCP/IPinstead of Named Pipes, at the end of the Data Source is the port to use (1433is the default))
Declare the SqlConnection:
C#:
usingSystem.Data.SqlClient;
SqlConnectionoSQLConn = new SqlConnection();
oSQLConn.ConnectionString="myconnection string";
oSQLConn.Open();
VB.NET:
ImportsSystem.Data.SqlClient
DimoSQLConn As SqlConnection = New SqlConnection()
oSQLConn.ConnectionString="myconnection string"
oSQLConn.Open()
Data Shape
MS Data Shape
"Provider=MSDataShape;DataProvider=SQLOLEDB;Data Source=Aron1;Initial Catalog=pubs;UserID=sa;Password=asdasd;"
Want tolearn data shaping? Check out 4GuyfFromRolla's great article about Data Shaping>>
Read more
How to define which network protocol to use
Example:
"Provider=sqloledb;DataSource=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;UserID=sa;Password=asdasd;"
NameNetwork library
dbnmpntwWin32 Named Pipes
dbmssocnWin32 Winsock TCP/IP
dbmsspxnWin32 SPX/IPX
dbmsvinnWin32 Banyan Vines
dbmsrpcnWin32 Multi-Protocol (Windows RPC)
Importantnote!
Whenconnecting through the SQLOLEDB provider use the syntax NetworkLibrary=dbmssocn
and whenconnecting through MSDASQL provider use the syntax Network=dbmssocn
All SqlConnection connection string properties
Thistable shows all connection string properties for the ADO.NET SqlConnectionobject. Most of the properties are also used in ADO. All properties and descriptions is frommsdn.
NameDefault Description
applicationName The name of the application, or'.Net SqlClient Data Provider' if no application name is provided.
AttachDBFilename
-or-
extendedproperties
-or-
InitialFile Name The name of the primary file,including the full path name, of an attachable database. The database name mustbe specified with the keyword 'database'.
ConnectTimeout
-or-
ConnectionTimeout 15 The length of time (in seconds) to wait for a connection to theserver before terminating the attempt and generating an error.
ConnectionLifetime 0 When a connection is returned to the pool, its creation time iscompared with the current time, and the connection is destroyed if that timespan (in seconds) exceeds the value specified by connection lifetime. Useful inclustered configurations to force load balancing between a running server and aserver just brought on-line.
ConnectionReset 'true' Determines whether the database connection is reset when beingremoved from the pool. Setting to 'false' avoids making an additional serverround-trip when obtaining a connection, but the programmer must be aware thatthe connection state is not being reset.
CurrentLanguage The SQL Server Language recordname.
DataSource
-or-
Server
-or-
Address
-or-
Addr
-or-
NetworkAddress The name or network address ofthe instance of SQL Server to which to connect.
Enlist'true' When true, the pooler automatically enlists the connection in thecreation thread's current transaction context.
InitialCatalog
-or-
Database The name of the database.
IntegratedSecurity
-or-
Trusted_Connection'false' Whether the connection is to be a secure connection or not. Recognizedvalues are 'true', 'false', and 'sspi', which is equivalent to 'true'.
Max PoolSize 100 The maximum number of connections allowed in the pool.
Min PoolSize 0 The minimum number of connections allowed in the pool.
NetworkLibrary
-or-
Net'dbmssocn' The network library used to establish a connection to an instance ofSQL Server. Supported values include dbnmpntw (Named Pipes), dbmsrpcn(Multiprotocol), dbmsadsn (Apple Talk), dbmsgnet (VIA), dbmsipcn (SharedMemory) and dbmsspxn (IPX/SPX), and dbmssocn (TCP/IP).
Thecorresponding network DLL must be installed on the system to which you connect.If you do not specify a network and you use a local server (for example,"." or "(local)"), shared memory is used.
PacketSize 8192 Size in bytes of the network packets used to communicate with aninstance of SQL Server.
Password
-or-
Pwd The password for the SQL Server accountlogging on.
PersistSecurity Info 'false' When set to 'false', security-sensitive information, suchas the password, is not returned as part of the connection if the connection isopen or has ever been in an open state. Resetting the connection string resetsall 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 the appropriate pool.
UserID The SQL Server login account.
WorkstationID the local computer name The name of the workstation connecting to SQLServer.
Note
Use ; toseparate each property.
If a nameoccurs more than once, the value from the last one in the connection stringwill be used.
If youare building your connection string in your app using values from user inputfields, make sure the user can't change the connection string by inserting anadditional property with another value within the user value.
SQL Server 2005
SQL Native Client ODBC Driver
Standard security:
"Driver={SQLNative Client};Server=Aron1;Database=pubs;UID=sa;PWD=asdasd;"
Trusted connection:
"Driver={SQLNative Client};Server=Aron1;Database=pubs;Trusted_Connection=yes;"
Equivalents
IntegratedSecurity=SSPI equals Trusted_Connection=yes
Prompt for username and password:
oConn.Properties("Prompt")= adPromptAlways
oConn.Open"Driver={SQL Native Client};Server=Aron1;DataBase=pubs;"
Enabling MARS (multiple active result sets):
"Driver={SQLNativeClient};Server=Aron1;Database=pubs;Trusted_Connection=yes;MARS_Connection=yes"
Equivalents
MultipleActiveResultSets=trueequals MARS_Connection=yes
UsingMARS with SQL Native Client, by Chris Lee >>
Encrypt data sent over network:
"Driver={SQLNativeClient};Server=Aron1;Database=pubs;Trusted_Connection=yes;Encrypt=yes"
Attach a database file on connect to a localSQL Server Express instance:
"Driver={SQLNative Client};Server=./SQLExpress;AttachDbFilename=c:/asd/qwe/mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;"
- or -
"Driver={SQLNativeClient};Server=./SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;"
(use |DataDirectory| when your database fileresides in the data directory)
Why isthe "Database" parameter needed? Answer: If the database waspreviously attached, SQL Server does not reattach it (it uses the attacheddatabase as the default for the connection).
Downloadthe SQL Native Client here >> (the package contains booth the ODBC driverand the OLE DB provider)
Using SQLServer 2005 Express? Don't miss the server name syntax: SERVERNAME/SQLEXPRESS(Substitute "SERVERNAME" with the name of the computer)
SQL Native Client OLE DB Provider
Standard security:
"Provider=SQLNCLI;Server=Aron1;Database=pubs;UID=sa;PWD=asdasd;"
Trusted connection:
"Provider=SQLNCLI;Server=Aron1;Database=pubs;Trusted_Connection=yes;"
Equivalents
IntegratedSecurity=SSPI equals Trusted_Connection=yes
Prompt for username and password:
oConn.Properties("Prompt")= adPromptAlways
oConn.Open"Provider=SQLNCLI;Server=Aron1;DataBase=pubs;"
Enabling MARS (multiple active result sets):
"Provider=SQLNCLI;Server=Aron1;Database=pubs;Trusted_Connection=yes;MarsConn=yes"
Equivalents
MarsConn=yesequals MultipleActiveResultSets=true equals MARS_Connection=yes
UsingMARS with SQL Native Client, by Chris Lee >>
Encrypt data sent over network:
"Provider=SQLNCLI;Server=Aron1;Database=pubs;Trusted_Connection=yes;Encrypt=yes"
Attach a database file on connect to a localSQL Server Express instance:
"Provider=SQLNCLI;Server=./SQLExpress;AttachDbFilename=c:/asd/qwe/mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;"
- or -
"Provider=SQLNCLI;Server=./SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;"
(use |DataDirectory| when your database fileresides in the data directory)
Why isthe "Database" parameter needed? Answer: If the database waspreviously attached, SQL Server does not reattach it (it uses the attacheddatabase as the default for the connection).
Downloadthe SQL Native Client here >> (the package contains booth the ODBC driverand the OLE DB provider)
Using SQLServer 2005 Express? Don't miss the server name syntax: SERVERNAME/SQLEXPRESS(Substitute "SERVERNAME" with the name of the computer)
SqlConnection (.NET)
Standard Security:
"DataSource=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
- or -
"Server=Aron1;Database=pubs;UserID=sa;Password=asdasd;Trusted_Connection=False"
(both connection strings produces the sameresult)
Trusted Connection:
"DataSource=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
- or -
"Server=Aron1;Database=pubs;Trusted_Connection=True;"
(both connection strings produces the sameresult)
(useserverName/instanceName as Data Source to use an specifik SQLServer instance)
Connect via an IP address:
"DataSource=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;UserID=sa;Password=asdasd;"
(DBMSSOCN=TCP/IPinstead of Named Pipes, at the end of the Data Source is the port to use (1433is the default))
Enabling MARS (multiple active result sets):
"Server=Aron1;Database=pubs;Trusted_Connection=True;MultipleActiveResultSets=true"
Note! UseADO.NET 2.0 for MARS functionality. MARS is not supported in ADO.NET 1.0 norADO.NET 1.1
Streamlineyour Data Connections by Moving to MARS, by Laurence Moroney, DevX.com >>
Attach a database file on connect to a localSQL Server Express instance:
"Server=./SQLExpress;AttachDbFilename=c:/asd/qwe/mydbfile.mdf;Database=dbname;Database=dbname;Trusted_Connection=Yes;"
- or -
"Server=./SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf;Database=dbname;Trusted_Connection=Yes;"
(use |DataDirectory| when your database fileresides in the data directory)
Why isthe "Database" parameter needed? Answer: If the database waspreviously attached, SQL Server does not reattach it (it uses the attacheddatabase as the default for the connection).
Using "User Instance" on a local SQLServer Express instance:
"DataSource=./SQLExpress;integratedsecurity=true;attachdbfilename=|DataDirectory|/mydb.mdf;userinstance=true;"
The"User Instance" functionality creates a new SQL Server instance onthe fly during connect. This works only on a local SQL Server 2005 instance andonly when connecting using windows authentication over local named pipes. Thepurpose is to be able to create a full rights SQL Server instance to a userwith limited administrative rights on the computer. To enable thefunctionality: sp_configure 'user instances enabled','1' (0 to disable)
Using SQLServer 2005 Express? Don't miss the server name syntax: SERVERNAME/SQLEXPRESS(Substitute "SERVERNAME" with the name of the computer)
Context Connection - connecting to"self" from within your CLR stored prodedure/function
C#:
using(SqlConnectionconnection = new SqlConnection("context connection=true"))
{
connection.Open();
// Use the connection
}
Visual Basic:
Usingconnection as new SqlConnection("context connection=true")
connection.Open()
' Use the connection
End Using
Thecontext connection lets you execute Transact-SQL statements in the same context(connection) that your code was invoked in the first place.
Read more
When to use SQL Native Client?
.Net applications
Do notuse the SQL Native Client. Use the .NET Framework Data Provider for SQL Server(SqlConnection).
COM applications, all other then .Netapplications
Use theSQL Native Client if you are accessing an SQL Server 2005 and need the newfeatures of SQL Server 2005 such as MARS, encryption, xml data type etc.Continue use your current provider (OLE DB / ODBC through the MDAC package) ifyou are not connecting to an SQL Server 2005 (that's quite obvious eh..) or ifyou are connecting to an SQL Server 2005 but are not using any of the new SQLServer 2005 features.
For moredetails on the differences between MDAC and SQL Native Client, read this msdnarticle >>
Access
ODBC
Standard Security:
"Driver={MicrosoftAccess Driver (*.mdb)};Dbq=C:/mydatabase.mdb;Uid=Admin;Pwd=;"
Workgroup:
"Driver={MicrosoftAccess Driver (*.mdb)};Dbq=C:/mydatabase.mdb;SystemDB=C:/mydatabase.mdw;"
Exclusive:
"Driver={MicrosoftAccess Driver (*.mdb)};Dbq=C:/mydatabase.mdb;Exclusive=1;Uid=admin;Pwd="
OLE DB, OleDbConnection (.NET)
Standard security:
"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=/somepath/mydb.mdb;User Id=admin;Password=;"
Workgroup (system database):
"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=/somepath/mydb.mdb;Jet OLEDB:System Database=system.mdw;"
With password:
"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=/somepath/mydb.mdb;Jet OLEDB:Database Password=MyDbPassword;"
MySQL
MyODBC
MyODBC 2.50 Local database:
"Driver={mySQL};Server=localhost;Option=16834;Database=mydatabase;"
MyODBC 2.50 Remote database:
"Driver={mySQL};Server=data.domain.com;Port=3306;Option=131072;Stmt=;Database=my-database;Uid=username;Pwd=password;"
MyODBC 3.51 Local database:
"DRIVER={MySQLODBC 3.51 Driver};SERVER=localhost;DATABASE=myDatabase;USER=myUsername;PASSWORD=myPassword;OPTION=3;"
MyODBC 3.51 Remote database:
"DRIVER={MySQLODBC 3.51 Driver};SERVER=data.domain.com;PORT=3306;DATABASE=myDatabase;USER=myUsername;PASSWORD=myPassword;OPTION=3;"
OLE DB, OleDbConnection (.NET)
Standard:
"Provider=MySQLProv;DataSource=mydb;User Id=UserName;Password=asdasd;"
Connector/Net 1.0 (.NET)
Standard:
"Server=Server;Database=Test;Uid=UserName;Pwd=asdasd;"
Downloadthe driver at MySQL Developer Zone.
Specifying port:
"Server=Server;Port=1234;Database=Test;Uid=UserName;Pwd=asdasd;"
Defaultport is 3306. Enter value -1 to use a named pipe connection.
Declare the MySqlClient connection:
C#:
usingMySql.Data.MySqlClient;
MySqlConnectionoMySqlConn = new MySqlConnection();
oMySqlConn.ConnectionString= "Server=Server;Database=Test;Uid=UserName;Pwd=asdasd;";
oMySqlConn.Open();
VB.NET:
ImportsMySql.Data.MySqlClient
DimoMySqlConn As MySqlConnection = New MySqlConnection()
oMySqlConn.ConnectionString= "Server=Server;Database=Test;Uid=UserName;Pwd=asdasd;"
oMySqlConn.Open()
MySqlConnection (.NET)
eInfoDesigns.dbProvider:
"DataSource=server;Database=mydb;User ID=username;Password=pwd;CommandLogging=false"
This oneis used with eInfoDesigns dbProvider, an add-on to .NET
Declare the MySqlConnection:
C#:
usingeInfoDesigns.dbProvider.MySqlClient;
MySqlConnectionoMySqlConn = new MySqlConnection();
oMySqlConn.ConnectionString= "my connection string";
oMySqlConn.Open();
VB.NET:
ImportseInfoDesigns.dbProvider.MySqlClient
DimoMySqlConn As MySqlConnection = New MySqlConnection()
oMySqlConn.ConnectionString= "my connection string"
oMySqlConn.Open()
SevenObjects MySqlClient (.NET)
Standard:
"Host=server;UserName=myusername; Password=mypassword;Database=mydb;"
This is afreeware ADO.Net data provider from SevenObjects
Core Labs MySQLDirect (.NET)
Standard:
"UserID=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 moreat Core Lab and the product page.
Interbase
ODBC, Easysoft
Local computer:
"Driver={EasysoftIB6ODBC};Server=localhost;Database=localhost:C:/mydatabase.gdb;Uid=username;Pwd=password"
Remote Computer:
"Driver={EasysoftIB6ODBC};Server=ComputerName;Database=ComputerName:C:/mydatabase.gdb;Uid=username;Pwd=password"
Read moreabout this driver: Easysoft ODBC-Interbase driver >>
ODBC, Intersolv
Local computer:
"Driver={INTERSOLVInterBase ODBC Driver(*.gdb)};Server=localhost;Database=localhost:C:/mydatabase.gdb;Uid=username;Pwd=password"
Remote Computer:
"Driver={INTERSOLVInterBase ODBC Driver(*.gdb)};Server=ComputerName;Database=ComputerName:C:/mydatabase.gdb;Uid=username;Pwd=password"
Thisdriver are provided by DataDirect Technologies >> (formerly Intersolv)
OLE DB, SIBPROvider
Standard:
"provider=sibprovider;location=localhost:;datasource=c:/databases/gdbs/mygdb.gdb;user id=SYSDBA;password=masterkey"
Specifying character set:
"provider=sibprovider;location=localhost:;datasource=c:/databases/gdbs/mygdb.gdb;user id=SYSDBA;password=masterkey;characterset=ISO8859_1"
Specifying role:
"provider=sibprovider;location=localhost:;datasource=c:/databases/gdbs/mygdb.gdb;userid=SYSDBA;password=masterkey;role=DIGITADORES"
Read moreabout SIBPROvider >>
Read moreabout connecting to Interbase in this Borland Developer Network articlehttp://community.borland.com/article/0,1410,27152,00.html
IBM DB2
OLE DB, OleDbConnection (.NET) from ms
TCP/IP:
"Provider=DB2OLEDB;NetworkTransport Library=TCPIP;Network Address=XXX.XXX.XXX.XXX;InitialCatalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;UserID=MyUser;Password=MyPW"
APPC:
"Provider=DB2OLEDB;APPCLocal LU Alias=MyAlias;APPC Remote LU Alias=MyRemote;InitialCatalog=MyCtlg;Package Collection=MyPkgCol;Default Schema=Schema;UserID=MyUser;Password=MyPW"
IBM's OLE DB Provider (shipped with IBM DB2UDB v7 or above)
TCP/IP:
Provider=IBMDADB2;Database=sample;HOSTNAME=db2host;PROTOCOL=TCPIP;PORT=50000;uid=myUserName;pwd=myPwd;
ODBC
Standard:
"driver={IBMDB2 ODBCDRIVER};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={SYBASEASE ODBC Driver};Srvr=Aron1;Uid=username;Pwd=password"
Standard Sybase System 11:
"Driver={SYBASESYSTEM 11};Srvr=Aron1;Uid=username;Pwd=password;Database=mydb"
For moreinformation check out the Adaptive Server EnterpriseDocument Sets
Intersolv 3.10:
"Driver={INTERSOLV3.10 32-BIT Sybase};Srvr=Aron1;Uid=username;Pwd=password;"
Sybase SQL Anywhere (former Watcom SQL ODBCdriver):
"ODBC;Driver=Sybase SQL Anywhere 5.0;DefaultDir=c:/dbfolder/;Dbf=c:/mydatabase.db;Uid=username;Pwd=password;Dsn="""""
Note! Thetwo double quota following the DSN parameter at the end are escaped quotas (VBsyntax), 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 inerror 7778.
Read morein the Sybase SQL Anywhere User Guide (see part 3, chapter 13) >>
OLE DB
Adaptive Server Anywhere (ASA):
"Provider=ASAProv;Datasource=myASA"
Read morein the ASA User Guide (part 1, chapter 2) >>
Adaptive Server Enterprise (ASE) with DataSource .IDS file:
"Provider=SybaseASE OLE DB Provider; Data source=myASE"
Note thatyou must create a Data Source .IDS file using the Sybase Data Administrator.These .IDS files resemble ODBC DSNs.
Adaptive Server Enterprise (ASE):
"Provider=Sybase.ASEOLEDBProvider;Srvr=myASEserver,5000;Catalog=myDBname;UserId=username;Password=password"
- some reports on problem using the aboveone, try the following as an alternative -
"Provider=Sybase.ASEOLEDBProvider;ServerName=myASEserver,5000;Initial Catalog=myDBname;UserId=username;Password=password"
This oneworks only from Open Client 12.5 where the server port number featureworks,?allowing fully qualified connection strings to be used withoutdefining?any .IDS Data Source files.
AseConnection (.NET)
Standard:
"DataSource='myASEserver';Port=5000;Database='myDBname';UID='username';PWD='password';"
Declare the AseConnection:
C#:
using Sybase.Data.AseClient;
AseConnectionoCon = new AseConnection();
oCon.ConnectionString="myconnection string";
oCon.Open();
VB.NET:
ImportsSystem.Data.AseClient
Dim oConAs AseConnection = New AseConnection()
oCon.ConnectionString="myconnection string"
oCon.Open()
Readmore! Adaptive Server EnterpriseADO.NET Data Provider Documentation >>
Informix
ODBC
Informix 3.30:
"Dsn='';Driver={INFORMIX3.30 32BIT};Host=hostname;Server=myserver;Service=service-name;Protocol=olsoctcp;Database=mydb;UID=username;PWD=myPwd
Informix-CLI 2.5:
"Driver={Informix-CLI2.5 (32 Bit)};Server=myserver;Database=mydb;Uid=username;Pwd=myPwd"
OLE DB
IBM Informix OLE DB Provider:
"Provider=Ifxoledbc.2;password=myPw;UserID=myUser;Data Source=dbName@serverName;Persist Security Info=true"
Ingres
ODBC
DSN-less
"Provider=MSDASQL.1;DRIVER=Ingres;SRVR=xxxxx;DB=xxxxx;PersistSecurity Info=False;uid=xxxx;pwd=xxxxx;SELECTLOOPS=N;ExtendedProperties="""SERVER=xxxxx;DATABASE=xxxxx;SERVERTYPE=INGRES""
Mimer SQL
ODBC
Standard Security:
"Driver={MIMER};Database=mydb;Uid=myuser;Pwd=mypw;"
Prompt for username and password:
"Driver={MIMER};Database=mydb;"
Lightbase
Standard
Standard:
"user=USERLOGIN;password=PASSWORD;UDB=USERBASE;server=SERVERNAME"
PostgreSQL
Core Labs PostgreSQLDirect (.NET)
Standard:
"UserID=root; Password=pwd; Host=localhost; Port=5432; Database=testdb;Pooling=true;Min Pool Size=0; Max Pool Size=100; Connection Lifetime=0"
Read moreat Core Lab and the product page.
PostgreSQL driver
Standard:
"DRIVER={PostgreSQL};SERVER=ipaddress;port=5432;DATABASE=dbname;UID=username;PWD=password;"
Npgsql by pgFoundry (.NET)
SSL activated:
"Server=127.0.0.1;Port=5432;Userid=myuserid;password=mypw;Protocol=3;SSL=true;Pooling=true;MinPoolSize=3;MaxPoolSize=20;Encoding=UNICODE;Timeout=20;SslMode=Require"
Without SSL:
"Server=127.0.0.1;Port=5432;Userid=myuserid;password=mypw;Protocol=3;SSL=false;Pooling=true;MinPoolSize=1;MaxPoolSize=20;Encoding=UNICODE;Timeout=15;SslMode=Disable"
Read morein the Npgsql: User's Manual and on the pgFoundry website.
Paradox
ODBC
5.X:
Driver={MicrosoftParadox Driver (*.db )};DriverID=538;Fil=Paradox5.X;DefaultDir=c:/pathToDb/;Dbq=c:/pathToDb/;CollatingSequence=ASCII"
7.X:
"Provider=MSDASQL.1;PersistSecurity Info=False;Mode=Read;ExtendedProperties='DSN=Paradox;DBQ=C:/myDb;DefaultDir=C:/myDb;DriverId=538;FIL=Paradox7.X;MaxBufferSize=2048;PageTimeout=600;';Initial Catalog=C:/myDb"
OleDbConnection (.NET)
Standard
"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:/myDb;Extended Properties=Paradox 5.x;"
MSkb-article: How to use Paradox data with Access and Jet >>
DSN
ODBC
DSN:
"DSN=myDsn;Uid=username;Pwd=;"
File DSN:
"FILEDSN=c:/myData.dsn;Uid=username;Pwd=;"
Firebird
ODBC - IBPhoenix Open Source
Standard:
"DRIVER=Firebird/InterBase(r)driver;UID=SYSDBA;PWD=masterkey;DBNAME=D:/FIREBIRD/examples/TEST.FDB"
IBPhoenixODBC; More info, download etc >>
.NET - Firebird .Net Data Provider
Standard:
"User=SYSDBA;Password=masterkey;Database=SampleDatabase.fdb;DataSource=localhost;Port=3050;Dialect=3;Charset=NONE;Role=;Connectionlifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;PacketSize=8192;ServerType=0"
FirebirdADO.NET project >>
FirebirdADO.NET downloads >>
Excel
ODBC
Standard:
"Driver={MicrosoftExcel Driver(*.xls)};DriverId=790;Dbq=C:/MyExcel.xls;DefaultDir=c:/mypath;"
TIP! SQLsyntax: "SELECT * FROM [sheet1$]" - i.e. worksheet name followed by a"$" and wrapped in "[" "]" brackets.
OLE DB
Standard:
"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:/MyExcel.xls;Extended Properties=""Excel8.0;HDR=Yes;IMEX=1"""
"HDR=Yes;"indicates that the first row contains columnnames, not data
"IMEX=1;"tells the driver to always read "intermixed" data columns as text
TIP! SQLsyntax: "SELECT * FROM [sheet1$]" - i.e. worksheet name followed by a"$" and wrapped in "[" "]" brackets.
Text
ODBC
Standard:
"Driver={MicrosoftText Driver (*.txt; *.csv)};Dbq=c:/txtFilesFolder/;Extensions=asc,csv,tab,txt;"
OLE DB
Standard:
"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:/txtFilesFolder/;ExtendedProperties=""text;HDR=Yes;FMT=Delimited"""
"HDR=Yes;"indicates that the first row contains columnnames, not data
DBF / FoxPro
ODBC
standard:
"Driver={MicrosoftdBASE Driver (*.dbf)};DriverID=277;Dbq=c:/mydbpath;"
OLE DB, OleDbConnection (.NET)
standard:
"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:/folder;Extended Properties=dBASE IV;User ID=Admin;Password="
AS/400 (iSeries)
OLE DB, OleDbConnection (.NET)
IBM Client Access OLE DB provider:
"PROVIDER=IBMDA400;DATA SOURCE=MY_SYSTEM_NAME;USER ID=myUserName;PASSWORD=myPwd"
WhereMY_SYSTEM_NAME is the name given to the system connection inOperationsNavigator
IBM Client Access OLE DB provider:
"PROVIDER=IBMDA400;DATA SOURCE=MY_SYSTEM_NAME;USER ID=myUserName;PASSWORD=myPwd;DEFAULTCOLLECTION=MY_LIBRARY;"
WhereMY_SYSTEM_NAME is the name given to the System Connection, and MY_LIBRARY isthe name given to the library in iSeries Navigator.
ODBC
IBM Client Access ODBC driver:
"Driver={ClientAccess ODBC Driver(32-bit)};System=my_system_name;Uid=myUserName;Pwd=myPwd"
Exchange
OLE DB
Exchange OLE DB provider:
"ExOLEDB.DataSource"
Specifystore in the connection open command like this: conn.open"http://servername/mypublicstore"
Check outthis article at msdn >> and this one at Addison-Wesley >>
Visual FoxPro
OLE DB, OleDbConnection (.NET)
Database container (.DBC):
"Provider=vfpoledb.1;DataSource=C:/MyDbFolder/MyDbContainer.dbc;Collating Sequence=machine"
Free table directory:
"Provider=vfpoledb.1;DataSource=C:/MyDataDirectory/;Collating Sequence=general"
Force the provider to use an ODBC DSN:
""Provider=vfpoledb.1;DSN=MyDSN""
Read more(Microsoft msdn) >>
ODBC
Database container (.DBC):
"Driver={MicrosoftVisual FoxProDriver};SourceType=DBC;SourceDB=c:/myvfpdb.dbc;Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO"
Free Table directory:
"Driver={MicrosoftVisual FoxProDriver};SourceType=DBF;SourceDB=c:/myvfpdbfolder;Exclusive=No;Collate=Machine;NULL=NO;DELETED=NO;BACKGROUNDFETCH=NO"
"Collate=Machine"is the default setting, for other settings check the list of supportedcollating sequences >>
MicrosoftVisual Foxpro site: http://msdn.microsoft.com/vfoxpro
Pervasive
ODBC
Standard:
"Driver={PervasiveODBC Client Interface};ServerName=srvname;dbq=@dbname"
PervasiveODBC info >>
OLE DB
Standard:
"Provider=PervasiveOLEDB;DataSource=C:/path"
PervasiveOLE DB info >>
UDL
UDL
UDL:
"FileName=c:/myDataLink.udl;"
- 数据库连接字符串大全
- 数据库连接字符串大全
- 数据库连接字符串大全
- 数据库连接字符串大全[转载]
- 数据库连接字符串大全
- 数据库连接字符串大全
- 数据库连接字符串大全
- 数据库连接字符串大全
- 数据库连接字符串大全
- 数据库连接字符串大全
- 数据库连接字符串大全(1)
- ASP数据库连接字符串大全
- 数据库连接字符串大全
- 数据库连接字符串大全
- 数据库连接字符串大全
- 数据库连接字符串大全整理
- 数据库连接字符串大全
- 数据库连接字符串大全
- Matlab 字符串处理
- 给定两列数据,生成树结构
- php实现文件上传的一些经验(摘录)
- 培训实习生-----面向对象基础
- 用rand_shuffle随机化序列元素
- 数据库连接字符串大全
- php获取客户端IP地址的几种方法
- 给定一个非常长的字节序列(假设有十亿或万亿),如何高效的统计1的个数
- 在存有10亿个数的文件中找出100万个数
- strncpy code
- Linux操作系统下以不同颜色命名的文件类型!
- 认知 android.app.SearchManager
- CString、char*互转 对receive和send的理解
- Neural networks