一、环境 OS:Linux myhostname 2.6.9-.ELsmp #1 SMP Sat Aug :: CDT i i i GNU/Linux CentOS release 4.4 (Final) Oracle:Oracle Database g Enterprise Edition Release .2.0.1.0 - Prod,数据库已经安装好 mysql:5.1.-community for windows 二、安装配置 1. 安装unixODBC,用root用户 rpm -Uvh unixODBC-2.2.-1.el4s1.1.i.rpm 2. 安装mysql ODBC,用root用户 rpm -Uvh mysql-connector-odbc-5.1.5-0.i.rpm 3. 安装oracle gateway,用oracle用户 我装的是_gateways_linux.zip unzip _gateways_linux.zip cd gateways ./runInstaller 安装方法和oracle db 软件一样,我把gateway和db装一起了,共用一个OracleHOME 4. 配置/etc/odbc.ini [DSName] Driver =/usr/lib/libmyodbc5.so Description =MySQL Server =xxx.xxx.xxx.xxx Port = User =root UID =root Password = mypass Database =mysqldbname Option =3 Socket = charset =utf8 测试ODBC isql -v DSName root mypass 5. 配置$ORACLE_HOME/hs/admin/initDSName.ora HS_FDS_CONNECT_INFO = DSName HS_FDS_TRACE_LEVEL = 0 HS_FDS_SHAREABLE_NAME = /usr/lib/libmyodbc5.so 6. 配置listener.ora,加红色部分 SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /usr/u/app/oracle/product/.2.0/db_1) (PROGRAM = extproc) ) (SID_DESC = (GLOBAL_DBNAME = BOSS) (ORACLE_HOME = /usr/u/app/oracle/product/.2.0/db_1) (SID_NAME = BOSS) ) (SID_DESC = (SID_NAME = phpcms) (ORACLE_HOME = /usr/u/app/oracle/product/.2.0/db_1) (PROGRAM = hsodbc) ) ) 7. 配置tnsnames.ora,添加 DSName = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = ..0.)(PORT = )) ) (CONNECT_DATA = (SERVICE_NAME = DSName)) (HS = OK) ) 8. 重启监听器并测试 lsnrctl reload lsnrctl service Service "DSName" has 1 instance(s). Instance "DSName", status UNKNOWN, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:3 refused:0 LOCAL SERVER The command completed successfully tnsping DSName Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = ..0.)(PORT = ))) (CONNECT_DATA = (SERVICE_NAME = DSName)) (HS = OK)) OK (0 msec) 9. 建立dblink CREATE PUBLIC DATABASE LINK linkname CONNECT TO "root" IDENTIFIED BY <PWD> USING 'DSName'; . 测试 select "name" from t1@linkname; 三、遗留问题 1. 字符集问题,最好oracle和mysql是utf8,否则中文有问题 2. text字段会报错: select "textcol" from t1@linkname; ORA-: 连接 ORACLE 到非 Oracle 系统时返回此信息: [Generic Connectivity Using ODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.-community]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"t1" WHERE "id"=1' at line 1 (SQL State: ; SQL Code: ) ORA-: 紧接着 2 lines (起自 DSName) 本来想用datadirect的mysql ODBC试试,可只支持mysql enterprise版本,实在不好找,以后有机会再说吧。
推荐整理分享通过HSODBC访问mysql的实现步骤(cmd 访问mysql),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:通过web访问数据库的过程,通过什么访问数据库,通过什么访问数据库,myeclipse访问项目地址,如何访问mysql,myeclipse访问数据库的步骤,myeclipse访问数据库的步骤,访问mysql数据库时,用来选择并打开指定数据库的方法是,内容如对您有帮助,希望把文章链接给更多的朋友!
两个MySql服务的应用 两个MySql服务的应用一、如何在同一系统中安装两个MySql服务。安装一个5.0版本的,再安装一个5.1版本的就可以了。我用的是mysql-5.0.-win.zip和mysql-5.1.
mysql 备份与迁移 数据同步方法 不过最近发现这个可视化操作有点点问题,就是当数据条数超过一定数目EMSSQLManager就挂了,也不知道是否是软件问题……当然该开始我是将大的数据库
3步搞定纯真IP数据导入到MySQL的方法详解 前提:你会用vi。很明显,本文是在Linux下测试通过的。本文用的是MySQL命令行工具,如果你不会,用phpMyAdmin应该也可以。第1步:下载纯真IP数据,解压