cancel
Showing results for 
Search instead for 
Did you mean: 

isql generates empty output file

Former Member
0 Kudos

Hello,

I am trying to connect to a Sybase ASE 15.7 data server in bash on Red Hat with isql the following way:

isql -S host.domain:port -U myLogin -P myPassword -i input.sql -o output.txt

input.sql contains the following text:

use master

go

select count(*) from syslogins

go

output.txt is being generated but unfortunately it is all empty.

If I run the exact same command in cmd.exe on Windows it generates output.txt with the actual result set:

-----------

83

(1 row affected)

How could I make isql work in bash so it does not generate empty output file but one with the actual result?

Permissions on input.sql are OK, it has 700 on it.

Thanks in advance.

Laszlo

Accepted Solutions (1)

Accepted Solutions (1)

former_member188958
Active Contributor

The usual reason for an empty output file in this sort of situation is isql not seeing a valid batch terminator
after the statement that should produce the output, causing isql to simply exit without any error. Most
other situations result in at least some error message in the output file.


I see that you do have a final "go" in your script, but perhaps something isn't quite right.
The "go" must start on the first character on the line, and there should be a newline character
after it (though there can be whitespace, comments, etc)

Examine the input file with "od -x input.txt" to see exactly what is on the line with the final "go"

Try adding a blank line after the final go.

Answers (2)

Answers (2)

SybDBA
Participant

Hi https://answers.sap.com/users/27746/laszlo.html ,

Notepad++ is having issue of adding junk characters , so better to use Notepad (provided by MS) or vi(*nix default editor).

Thanks

Pankaj

former_member89972
Active Contributor

Check if utilities dos2unix and unix2dos allow you to convert text file contents to the OS platform you want to use.

This is typically the "control-M" character which is not visible when you take a dos file to unix and try to use it "as is"

HTH

Avinash

Former Member
0 Kudos

Bret, Mark,

Thanks very much for your comments, I appreciate it.

You were right, the issue was with the end of line characters \r\n which is now set to \n. Should start using vi more instead of Notepad++ / SFTP on Windows :).

Now that this works fine, I can start adding more complex code into input.sql as per my original intention.

Thanks again.

Regards,

Laszlo