We are using an old version of isql to connect to Informix DB from Linux (RHEL 6.10)
The format we are using to run a select SQL is:
isql -v -k $INX_DRIVER -x0xEC -b < ${sql_file} > ${out_file}
When there are errors while running the SQL, the above call does not end and infinitely keeps adding error message in the log file.
How can I specify during isql call to exit on error/exception?
The man page has this option which sound like should do the trick but the description is not clear enough for me to be sure.
-3 Use the ODBC 3 calls.
I think this option would end isql call if there are 3 errors/exceptions.
Is my understanding correct?
Related
I want to know whether psql commands be executed from an Application ?
For example I want to make use of \crosstabview functionality which psql provides. It is a great feature to have when viewing the reports.
I have an application which uses Ruby on Rails. I'm thinking whether I can run the \crosstabview from the application.
These are features of psql application only. There is no way to use them via database driver, be it ActiveRecord or anything else. That's just a different thing.
However, you can have table view using, for example, table_view gem.
Can psql commands be executed from Rails application?
It can theoretically be done by running psql from ruby. Its just a really clunky solution.
The psql --command option only takes a single function name or a SQL string that is parsable by the database and which cannot use psql specific functions. Which means that you can run for example %x{ psql --command "\\h"} but not \crosstableview which needs input.
That leaves using PTY to open an interactive session.
# example using PTY to connect to an interactive psql shell
require 'pty'
require 'expect'
PTY.spawn('psql') do |output, input, pid|
output.expect /\=\#/ do
input.puts '\\conninfo'
output.each do |line|
puts line
end
end
end
While possible there is a much better solution - use the crosstab function from the tablefunc extension which can be used with ActiveRecord::Base.connection.execute.
I managed to do this with "\ir" option provided by psql. By this option, you can run the commands written in a file. So put all commands that you want to run in CLI in a single file.
Now you just have to connect to psql and pass filename to "\i" option.
Example: I created a file "a.rb" and it inlcudes the following-
psql -h localhost -U postgres
\ir filename
I have some trouble executing/using vbs scripts linked to printers. They are located in %windir%/System32/Printing_Admin_Scripts
The objective is to plan a weekly print task to preserve ink cartridge
Looking at the scripts, everything was available for me to create this task
The main script to use is prnqctl.vbs
Before to create my task, I have tried to test the script and this is what I got (sorry for the french version, I will try to update the screenshot in english later):
There is obviously something wrong.
I have tried to google the error code, nothing conclusive.
I have tried to run my script in admin mode and also under admin session, same problem
I have made some research on CIMWin32, it seems to be a dll and I can find it in some locations of my filesystem
My OS is W8.1.
If anybody has a suggestion or solution, I'm interested in
==>cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnqctl.vbs -e
Unable to get printer instance. Error 0x80041002 Not found
Operation GetObject
Provider CIMWin32
Description
Win32 error code
The error culprit is clear: you should provide a valid -p argument. It's a mandatory parameter in case of -e operation:
==>cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnqctl.vbs -e -p "Fax"
Success Print Test Page Printer Fax
==>
Wondering where to find the dumped file of neo4j dump command. I was running Neo4j v2.1.3 in windows operating system. Please help thanks.
I believe the dump command just outputs to the console, so you need to redirect the output. Something like:
Neo4jShell.bat -c "dump match (n:People)-[:Shared]-(m) return n,m;" > social.connection.db\test2.cql
Edited with the Windows version of the command
For UNIX systems a similar command works:
neo4j-shell -c "dump match (n:People)-[:Shared]-(m) return n,m;" > social.connection.db/test2.cql
I need to query a MS SQL Server database from a linux terminal. Searching the web and this site I found freetds and then sqsh. I have installed them and seems to connect to the server but I can't get it to execute a query, I'm definitely doing something wrong.
I have configure freetds as:
[MSSql]
host = 192.168.1.4
port = 1433
tds version = 7.0
The databse server is a Sql Server 2008 r2.
When connecting I use the following command:
sqsh -S MSSql -U sa -P sa -D databasename
Which gives me a prompt like:
sqsh-2.1.7 Copyright (C) 1995-2001 Scott C. Gray
Portions Copyright (C) 2004-2010 Michael Peppler
This is free software with ABSOLUTELY NO WARRANTY
For more information type '\warranty'
1>
Then I try to enter a query like:
1> select * from C_PROPS;
But nothing happens. What am I doing wrong?, just need simple selects and updates.
I think that the semicolon_hack variable is not set.
You need to write your command like this
select * from C_PROPS
go
or, at the beginning of a sqsh session
\set semicolon_hack=on
go
now you can do
select * from C_PROPS;
or, alternatively, create a .sqshrc in your home directory and insert this snippet
#
# $semicolon_hack : This turns on the ability to use a semicolon as
# a sort of in-line go. It is kind of hacky but seems
# to work pretty well.
#
\set semicolon_hack=on
I have used the following command
vmc info |grep target
I can get the target info exactly. But when I type:
vmc apps |grep running
There is no output.
If I try to redirect the stdout to file like:
vmc apps &> tmplog
I was confused to see that only the first column of the output (appname) was written into the file. Any suggestions?
It may be the case that you need to redirect both unix output streams to see the complete log. There is STDOUT (1) and STDERR (2). To redirect both streams to the same file by using
vmc apps > tmplog 2 &> tmplog
Your last line above only redirected one output stream (STDOUT). The other stream may be written to to console instead.
Additionally, the vmc CLI is pretty much outdated. For the current go implementation of the CF CLI (gcf/cf), I successfully tested the following command to work
cf logs $YOUR_APP_NAME | grep RTR