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/[email protected]/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  // 包含OTL4.0头文件

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

odbc连接字符串_第1张图片

连接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/[email protected]/orcl");

 

你可能感兴趣的:(otlv4,MSSQL,oracle)