LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   odbc help (https://www.linuxquestions.org/questions/linux-newbie-8/odbc-help-838624/)

fernfrancis 10-17-2010 08:35 AM

odbc help
 
hi i followed these instruction to connect to DSN

1.Install UNIX ODBC.
Download UNIX ODBC from following link.
http://www.unixodbc.org/unixODBC-2.3.0.tar.gz
copy the unixODBC*.tar.gz file somewhere you can create files and directories
gunzip unixODBC*.tar.gz*
tar xvf unixODBC*.tar
Doing so will create a unixODBC directory with all source files inside.

2. Libraries and Programs
The install uses the standard GNU autoconf process. So its simply a matter of running
./configure*
make*
make install
By default the files are installed into /usr/local. As is usual with configure, this location can be changed by altering the prefix option to configure. i.e.
./configure --prefix=/usr/local/unixODBC
This will install the lib, bin, include and etc directories in /usr/local/unixODBC/lib etc.
To conform with the GNU guidelines the odbcinst file is now installed by default in {prefix}/etc, this can be altered using the --sysconfdir option to configure. To install the files in the old default /etc you would run configure like this
./configure --sysconfdir=/etc

3.Install oracle instant client for 10.2.0 version and set necessary environment variables. Please refer to oracle_env.sh file after installation (known and working solution: call this script in .bashrc file to set environment variables at terminal and ssh startup)


4.To create a DSN go to odbcinst.ini file in linux’s /etc directory and write following lines.
[ORACLE]
Driver=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/libsqora.so.10.1
(Note: This is our environment’s setup. We need access of libsqora.so.10.1
library. Set this path according to your environment.)

Now, go to odbc.ini file in /etc directory and write following lines.
[AADSN]
Driver=ORACLE
ServerName=10.200.2.81
Port=1521
Database=aadca

Now go to $ prompt and check this DSN with isql utility by following command
isql –v AADSN UserName Password
This must send you to sql prompt. Check by executing any simple query.

when i issue this command i get the error

[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect

can someone help me with this issue

Thanks

ShadowCat8 10-18-2010 06:39 PM

Just a couple quick thoughts:

Are you trying to specify the actual database in the command line? In the config file, you are specifying "aadca" and at the command line, you are specifying AADSN.

From translating the error output, it seems you couldn't connect because the system couldn't figure out what data source to connect to. The database "aadca" exists, right?

HTH. Let us know.

fernfrancis 10-19-2010 06:57 AM

yes the database exist. and is being currently used by another application.

ShadowCat8 10-19-2010 12:00 PM

Okay,

What is the output of
Code:

~ # odbcinst -q -d ORACLE
and then
Code:

~ # odbcinst -q -s aadca
?

HTH. Let us know.

fernfrancis 10-20-2010 12:04 AM

hi

this is the output
thusitha@isa-tbandara:~$ odbcinst -q -d ORACLE

[ORACLE]

thusitha@isa-tbandara:~$ odbcinst -q -s aadca

[AADSN]

ShadowCat8 10-21-2010 12:06 PM

Quote:

Originally Posted by fernfrancis
[ORACLE]
Driver=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/libsqora.so.10.1

You have confirmed that this driver library is there? (Just double-checking.)

Also, what do you have for a "[DEFAULT]" entry in your odbc.ini?

I found this and noted that even with a set entry in odbc.ini, isql seems to look for the default entry first.

HTH. Let us know.


All times are GMT -5. The time now is 01:45 PM.