odbc连接字符串

原文链接:http://www.cnblogs.com/mattins/archive/2011/06/07/2074029.html

access  "Driver={microsoft access driver(*.mdb)};dbq=*.mdb;uid=admin;pwd=pass;"

dBase  "Driver={microsoft dbase driver(*.dbf)};driverid=277;dbq=------------;"

oracle  "Driver={microsoft odbc for oracle};server=oraclesever.world;uid=admin;pwd=pass;"

MSSQL server  "Driver={sql server};server=servername;database=dbname;uid=sa;pwd=pass;"

MS text  "Driver={microsoft text driver(*.txt; *.csv)};dbq=-----;extensions=asc,csv,tab,txt;Persist SecurityInfo=false;"

Visual Foxpro  "Driver={microsoft Visual Foxpro driver};sourcetype=DBC;sourceDB=*.dbc;Exclusive=No;"

MySQL  "Driver={mysql};database=yourdatabase;uid=username;pwd=yourpassword;option=16386;"

SQLite  "Driver={SQLite3 ODBC Driver};Database=D:\SQLite\*.db"

PostgreSQL  "Driver={PostgreSQL ANSI};server=127.0.0.1;uid=admin;pwd=pass;database=databaseName"

oracle  "user/password@192.168.161.201/orcl"

连接MSSQL时,一些宏的定义:

#define OTL_ODBC_MSSQL_2008 // OTL 4.0/odbc编译为MS SQL 2008
//#define OTL_ODBC // OTL 4.0/odbc编译为 ODBC。当用 MS SQL 7.0 / 2000 时取消注释。
#define OTL_STL // 打开STL功能
#define OTL_ANSI_CPP // Turn on ANSI C++ typecasts
#include <otlv4.h> // 包含OTL4.0头文件

连接oracle时,由于我电脑没有安装oracle客户端,需要配置oracle环境,即oci.h,oci,lib,oci.dll等。如:

连接oracle数据库需要的宏和连接字符串:

#define OTL_STL
#define OTL_ORA10G_R2 // Compile OTL 4.0/OCI10gR2
#define OTL_ORA_SUBSCRIBE // Enable the otl_subscriber interface

// The following two #define's are required for 
// the otl_subscriber interface to function
#define OTL_ORA_OCI_ENV_CREATE 
#define OTL_ORA_OCI_ENV_CREATE_MODE (OCI_OBJECT|OCI_EVENTS)
#pragma comment(lib,"oci.lib")
#include"otlv4.h"
...
db.rlogon("user/password@192.168.123.123/orcl");

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值