DataBase ConnectionString (good)

Database EngineConnectionString
DBASE (using ODBC)Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=C:/path/to/database
Excel (using ODBC)Driver={Microsoft Excel Driver (*.xls)};DriverID=790;Dbq=C:/path/to/spreadsheet;DefaultDir=C:/path/to/defaultdir
Excel (using OLE DB)Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Path/To/sheet.xls;
Access (using ODBC)Driver={Microsoft Access Driver (*.mdb)};Dbq=C:/path/to/database.mdb;Uid=username;Pwd=password

You can also pass additional options -- for example Exclusive=1; sets it to be opened in exclusive mode.
Access (using OLE DB)Using standard security
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/path/to/database.mdb;User Id=username;Password=somepassword;

Using Workgroup security
str="Provider=Microsoft.Jet.OLEDB.4.0;DataSource=database.mdb;JET OLEDB:System Database=mysystem.mdw;"
oConn.Open(str, "my_user_name", "my_password")
FirebirdRemote Database
Provider='LCPI.IBProvider';Data Source='remotehost:C:/path/to/database.fdb';User ID='username';Password='pwd';Auto Commit=true;

The above is reported to work for a Firebird database by Edward Diamond (ediamond at water dot ca dot gov). I would presume that it could work on a local Firebird server, simply by removing "remotehost" from the string above. Edward reports that even simple queries don't work without the "Auto Commit" part in the connection string.
MySQL (using ODBC)Local Database
Driver={MySQL ODBC 3.51 Driver};Server=localhost;User=username;Password=mypassword;Database=mydatabase;

Remote Database
Driver={MySQL ODBC 3.51 Driver};Server=192.168.1.100;Port=3306;User=username;Password=mypassword;Database=mydatabase;

There are more parameters that can be set (for example, Option, which controls several connection properties such as logging, packet size limits etc.) See section 3.3 (Connection Parameters) of the MyODBC manual for more information.
MySQL (using OLE DB)Provider=MySQLProv;Server=192.168.1.100;Port=3306;User=username;Password=mypassword;Database=mydatabase;

If you have the datasource already set up:
Provider=MySQLProv;Data Source=name_of_datasource;

You will need to download and install MyOleDB first. Last time I checked MyOLEDB was no longer maintained.
Oracle (using ODBC)Driver={Microsoft ODBC for Oracle};Server=MyOracleServer;Uid=username;Pwd=password

See the MSDN library for additional options.
Oracle (using OLE DB)Using OLE DB provider from Microsoft
Provider=MSDAORA;Data Source=MyOracleDB;User Id=username;Password=password
See the MSDN library for additional options.

Using OLE DB provider from Oracle
Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=username;Password=password
SQL Server (using ODBC)Standard Security
Driver={SQL Server};Server=192.168.1.100;Uid=username;Pwd=password;Database=dbname;

Trusted Connection
Simply add Trusted_Connection=yes to the above string.

See MSDN Library for more options.
SQL Server (using OLE DB)Provider=SQLOLEDB.1;Data Source=192.168.1.100;Uid=username;Pwd=password;Database=dbname;

See MSDN Library for more options.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值