个人在安装配置时遇到一些麻烦,特此记录如下: 环境 数据库服务器操作系统:Windows 2003 数据库:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 erlang运行的服务器操作系统:Redhat 5.3 erlang:Erlang R14B03 (erts-5.8.4) 注意 ==========
个人在安装配置时遇到一些麻烦,特此记录如下:
-
环境
数据库服务器操作系统:Windows 2003
数据库:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0erlang运行的服务器操作系统:Redhat 5.3
erlang:Erlang R14B03 (erts-5.8.4)
- 注意
redhat 5.3中默认安装的unixODBC是2.2.11版本,这个版本与oracle的odbc驱动不兼容。所以需要将先将其卸载,然后安装unixODBC 2.3.0
卸载unixODBC的rpm包:
rpm -e mysql-connector-odbc-3.51.12-2.2.i386
rpm -e unixODBC-devel-2.2.11-7.1
rpm -e unixODBC-2.2.11-7.1
下载安装unixODBC 2.3.0
从www.unixodbc.org处下载,或者
http://olex.openlogic.com/package_versions/download/10003?package_version_id=5966&path=openlogic%2Funixodbc%2F2.3.0%2Fopenlogic-unixodbc-2.3.0-all-src-2.zip
在configure时加两个参数:--sysconfdir=/etc --prefix=/usr
然后make install就可以啦
安装完成后执行odbcinst -j可以看到配置文件等的位置
===============================================================================
1. 从Oracle网站下载客户端安装包
http://download.oracle.com/otn/linux/instantclient/11203/oracle-instantclient11.2-basic-11.2.0.3.0-1.i386.rpm
http://download.oracle.com/otn/linux/instantclient/11203/oracle-instantclient11.2-odbc-11.2.0.3.0-1.i386.rpm
最好再安装一下sqlplus
http://download.oracle.com/otn/linux/instantclient/11203/oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.i386.rpm
2. 配置lib目录
cd /usr/lib/oracle/11.2/client/lib
pwd >>/etc/ld.so.conf
ldconfig
3. 修改/etc/odbcinst.ini
增加如下:
# Driver form oracle
[Oracle]
Desription = ODBC for Oracle
Driver = /usr/lib/oracle/11.2/client/lib/libsqora.so.11.1
Setup = /usr/lib/liboraodbcS.so
FileUsage = 1
这个加到odbcinst.ini文件的最后。测试时用,正常使用时应该去掉
[ODBC]
Trace = 1
TraceFile =/tmp/odbc.log
Debug = 1
Pooling = No
4. 修改/etc/odbc.ini
增加如下
[ORCL_146] #本地数据源名
Description = ODBC for Oracle
Driver = Oracle
Server = 192.168.1.146
Port = 1521
ServerName = ORCL_146 #tnsnames.ora中的服务名
UserID = mycomm
Password = mycomm123
5. 增加/usr/lib/oracle/11.2/network/admin/tnsnames.ora
ORCL_146 =(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.146)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
其中ORCL_146要与odbc.ini的ServerName相同,
SERVICE_NAME为oracle的服务名
HOST为数据库所在主机IP,PORT为数据库所在主机port。
6. 在/etc/profile中增加:
export TNS_ADMIN=/usr/lib/oracle/11.2/network/admin/
然后,为了让TNS_ADMIN环境变化现在就生效,执行
. /etc/profile
7. 用isql测试一下
isql ORCL_146 -v
出错:
[01000][unixODBC][Driver Manager]Can't open lib '/usr/lib/oracle/11.2/client/lib/libsqora.so.11.1' : libclntsh.so.11.1: cannot open shared object file: No such file or directory
[ISQL]ERROR: Could not SQLConnect
发现是没有libclntsh.so.11.1这个库文件,这个库文件在/usr/lib/oracle/11.2/client/lib/下,之所以没有找到是由于在第2步时执行ldconfig的终端不是现在执行isql的终端。
重新执行一下ldconfig
再执行isql ORCL_146 -v
出错:
isql: symbol lookup error: /usr/lib/oracle/11.2/client/lib/libsqora.so.11.1: undefined symbol: SQLGetPrivateProfileStringW
这个问题就是unixODBC的版本问题啦,如果前面安装了unixODBC 2.3.0的话不会出现这个错误
如果sqlplus可以连接,但isql不可以,需要确认是否export了TNS_ADMIN这一环境变量
8. erlang odbc 连接oralce时出错如下:
------------------------------------------
Erlang R14B03 (erts-5.8.4) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.8.4 (abort with ^G)
1> odbc:start().
ok
2> odbc:connect("DSN=ORCL_146;UID=scott;PWD=tiger", []).
=ERROR REPORT==== 21-Oct-2011::19:23:49 ===
ODBC: received unexpected info: {tcp_closed,#Port}
{error,connection_closed}
3>
=ERROR REPORT==== 21-Oct-2011::19:23:49 ===
** Generic server terminating
** Last message in was {#Port,{exit_status,23}}
** When Server state == {state,#Port,
{,#Ref},
,undefined,on,undefined,undefined,on,
connecting,undefined,0,
[#Port,#Port],
#Port,#Port}
** Reason for termination ==
** {port_exit,collecting_of_driver_information_faild}
----------------------------------------------
根据这里的方法
http://www1.erlang.org/pipermail/erlang-questions/2005-August/016816.html
这样连接就可以啦
3> odbc:connect("DSN=ORCL_146;UID=scott;PWD=tiger", [{scrollable_cursors, off}]).
{ok,}
4>
其实这里可以不用UID和PWD,只要一个DSN就可以啦,形如:
odbc:connect("DSN=ORCL_146", [{scrollable_cursors, off}]).

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version
Chinese version, very easy to use

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
