LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-15-2024, 05:44 PM   #1
psaradha86
LQ Newbie
 
Registered: Aug 2023
Posts: 6

Rep: Reputation: 0
ISQL to connect to postgres in linux - [08S01]Could not send Query(connection dead) error


Hi,

I have postgres installed in linux and have my dsn setup as below

odbc.ini
[db]
Description = PostgreSQL connection to 'db' database
Driver = PostgreSQL
Database = db
Servername = localhost
UserName = db
Password = password
Trace = Yes
TraceFile = /logfilepath
Port = actualportnumbr
#Protocol =
#ReadOnly = No
#RowVersioning = No
#ShowSystemTables = No
#ShowOidColumn = No
#FakeOidIndex = No
#ConnSettings =

When I am logged in as myself,

[me@myip ]$ isql db db pass(from dsn) -v

SQL> drop table test1;
[08S01]Could not send Query(connection dead);
Could not send Query(connection dead)
[ISQL]ERROR: Could not SQLExecute
SQL> quit

But when I am logged as root

[root@myip]# isql db db pass(from dsn) -v
SQL> drop table test1; is success

OR

just login with db without explicitly specifying username/pass

[root@myip]# isql db -v
SQL> drop table test1; is success


SQL> SELECT rolname, rolsuper, rolcreaterole, rolcreatedb, rolcanlogin FROM pg_roles;

+-----------------------------------------------------------------+---------+--------------+------------+------------+
| rolname | rolsuper| rolcreaterole| rolcreatedb| rolcanlogin|
+-----------------------------------------------------------------+---------+--------------+------------+------------+

| me | 1 | 0 | 0 | 1 |

| db | 1 | 0 | 0 | 1 |


Am I missing any permissions? Any help would be appreciated
 
Old 08-15-2024, 06:33 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,127

Rep: Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076
I am only briefly familiar with isql but is your odbc.ini file posted the system wide i.e. /etc/odbc.ini file? If so does it have read permissions for all or by your me user? There is also a user specific dsn file i.e. $HOME/.odbc.ini by default that would over ride the system wide file. Does it exist for your user me and is it different? From my initial guess it isn't necessarily a role problem because you should be connecting as username db regardless of who you are logged in as i.e. me or root.
 
1 members found this post helpful.
Old 08-15-2024, 07:38 PM   #3
psaradha86
LQ Newbie
 
Registered: Aug 2023
Posts: 6

Original Poster
Rep: Reputation: 0
Thank you the help.
The home dir had
Protocol = 9.2
which was commented in /etc.

when I changed home to have the same as /etc, it worked.

I am new to odbc setup (I am a programmer) - Could you please let me know how without giving the userid and password explicity, it still works?
Does it take the information from odbc.ini file?
 
Old 08-15-2024, 08:28 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 26,127

Rep: Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076Reputation: 6076
Yes. The default configuration is read from the ini file first and then any command line options would override those in the file.
 
Old 08-16-2024, 12:39 AM   #5
psaradha86
LQ Newbie
 
Registered: Aug 2023
Posts: 6

Original Poster
Rep: Reputation: 0
thank you
 
  


Reply

Tags
linux, odbc, postgres, unixodbc


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
isql -v NetSuite produces just the error of [ISQL]ERROR: Could not SQLConnect subra Linux - Server 5 04-17-2019 12:33 AM
[ISQL]ERROR: Could not SQLConnect Mongo Database roshanbi Linux - Software 4 12-05-2018 03:33 PM
[SOLVED] Postgres 9.4 + unixODBC on Centos 6.5 problem connecting localhost postgres instance with ODBC isql rylan76 Linux - Server 1 07-22-2015 05:39 AM
Syntax (in Linux) for isql to connect to UDB. krishna.natesh Linux - Newbie 0 08-27-2008 02:24 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration