I encountered some trouble when installing the configuration, it is hereby recorded as follows: Environmental Database Server Operating System: Windows2003 Database: OracleDatabase10gEnterpriseEditionRelease10.2.0.1.0erlang running server operating system: Redhat5.3erlang: ErlangR14B03 (erts-5.8.4) Note
I encountered some trouble when installing the configuration. Here I will record the following: Environment Database Server Operating System: Windows 2003 Database: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 erlang server operating system: redhat 5.3 erlang: Erlang R14B03 (erts-5.8.4) Note ==============
I have encountered some troubles in installing the configuration, and I hereby record it as follows:
Database Server Operating System: Windows 2003
Database: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Erlang Running Server OS: Redhat 5.3
Erlang: Erlang R14B03 (erts-5.8.4)
========================================================== ========================================================
In redhat 5.3, the default unixODBC version is 2.2.11, which is incompatible with the oracle odbc driver. So you need to uninstall it first, and then install unixODBC 2.3.0
Uninstall the rpm package of unixODBC:
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
Download and install unixODBC 2.3.0
Download from www.unixodbc.org, or
Http://olex.openlogic.com/package_versions/download/10003? Bytes
Add two parameters to configure: -- sysconfdir =/etc -- prefix =/usr
Then make install.
After the installation is complete, execute odbcinst-j to view the location of the configuration file.
========================================================== ========================================================
1. Download the Client installation package from the Oracle website
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
You 'd better install sqlplus again.
Http://download.oracle.com/otn/linux/instantclient/11203/oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.i386.rpm
2. Configure the lib directory
Cd/usr/lib/oracle/11.2/client/lib
Pwd>/etc/ld. so. conf
Ldconfig
3. Modify/etc/odbcinst. ini
Add as follows:
# 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
Add this to the end of the odbcinst. ini file. Used for testing, should be removed during normal use
[ODBC]
Trace = 1
TraceFile =/tmp/odbc. log
Debug = 1
Pooling = No
4. Modify/etc/odbc. ini
Add the following
[ORCL_146] # Name of the local data source
Description = ODBC for Oracle
Driver = Oracle
Server = 192.168.1.146
Port = 1521
ServerName = ORCL_146 # service name in tnsnames. ora
UserID = mycomm
Password = mycomm123
5. Added/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)
)
)
Here, ORCL_146 must be the same as the ServerName of odbc. ini,
SERVICE_NAME is the service name of oracle
The HOST is the IP address of the HOST where the database is located, and the PORT is the port of the HOST where the database is located.
6. Add the following in/etc/profile:
Export TNS_ADMIN =/usr/lib/oracle/11.2/network/admin/
Then, to make the TNS_ADMIN environment change take effect now, run
./Etc/profile
7. Test it with isql.
Isql ORCL_146-v
Error:
[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: cocould not SQLConnect
No libclntsh is found. so.11.1 this library file is under/usr/lib/oracle/11.2/client/lib, the reason is that the terminal that executes ldconfig at Step 1 is not the terminal that executes isql.
Execute ldconfig again
Run isql ORCL_146-v.
Error:
Isql: symbol lookup error:/usr/lib/oracle/11.2/client/lib/libsqora. so.11.1: undefined symbol: SQLGetPrivateProfileStringW
This problem is caused by the unixODBC version. If unixODBC 2.3.0 is installed earlier, this error will not occur.
If sqlplus can be connected, but isql cannot, check whether TNS_ADMIN is export.
8. The following error occurs when erlang odbc is connected to 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 <0.725>}
{Error, connection_closed}
3>
= Error report = 21-Oct-2011: 19: 23: 49 =
** Generic server <0.39.0> terminating
** Last message in was {# Port <0.723>, {exit_status, 23 }}
** When Server state =={ state, # Port <0.723>,
{<0.32.0>, # Ref <0.0.0.38> },
<0.32.0>, undefined, on, undefined, undefined, on,
Connecting, undefined, 0,
[# Port <0.721>, # Port <0.722>],
# Port <0.724>, # Port <0.725>}
** Reason for termination =
** {Port_exit, collecting_of_driver_information_faild}
----------------------------------------------
According to the method here
Http://www1.erlang.org/pipermail/erlang-questions/2005-August/016816.html
In this way, you can connect.
3>
Odbc: connect ("DSN = ORCL_146; UID = scott; PWD = tiger", [{scrollable_cursors, off}]).
{OK, <0.41.0>}
4>
In fact, UID and PWD are not needed here, as long as a DSN is enough, such:
Odbc: connect ("DSN = ORCL_146", [{scrollable_cursors, off}]).