Permanently set DB2CLP environment variable - db2

I have a problem with DB2CLP environment variable, on Windows 7 64, IBM_client64_V97 (to be connected with DB2).
Every time when i try to DB2 in Windows command prompt window, I receive this error:
DB21061E Command line environment not initialized.
and per this document using just this step:
2. at the prompt enter these commands:
db2cmd -i -w db2clpsetcp
echo %DB2CLP%
I fix that error, and "db2" command opens Command Line Processor for DB2 Client.
But it lasts only until windows CMD is open. As soon as I close it and reopen, I have to repeat process.
My question (being absolute novice to DB2) is:
How should I make that change permanent and
How this happened at the first place as I installed and setup everything according to the manual (including adding local user to DB2USERS and DB2ADMINS) groups?

When DB2 client is installed, it should have installed a functional window to the command line processor. Check here:
Start / All Programs / IBM DB2 / DB2copy1/ Command Line Processor
Note that DB2copy1 is the default location for the first db2 instance. The name may be different if user select the non-default name.
Shortcut to the CLP can be copied on the desktop.
Regarding the typing "DB2 ..some command..." in windows command prompt which causes described error explanation is as follows:
That's because the normal DOS (or Windows) prompt doesn't
automatically run the setup script that enables the DB2 commands.
When the setup runs, it puts the DB2 items first in the PATH variable.
That could conflict with other tools that also want to be first on the
search list.
If you've got both the DOS (Windows) and DB2 command line prompts on
your desktop, right click them and select Properties. You'll notice
that the system (DOS) prompt runs cmd.exe.
The DB2 prompt runs DB2CMD.exe from the DB2 libraries. The DB2 script
then runs DB2SETCP.BAT and finally DB2.EXE. (All of the DB2
executables should be in C:\Program Files\IBM\SQLLIB\BIN.)
So there are differences in the two prompts. For you purposes, try
running DB2SETCP.BAT from the normal DOS prompt. That may be
sufficient for your needs.
For my purposes I always have the DOS and DB2 prompts on my desktop
and just select the one that I need.

Related

error appear when installing IBM Cloud CLI "'iex' is not recognized as an internal or external command..."

I'm trying to install IBM Cloud CLI but there is a problem faced me when I do this.
I added the Path to environment variables but it didn't work too !
This happens because the iex (shorthand for Invoke-Expression) command is a Powershell command, but it is entered to Command prompt. The latter is the old command shell that dates back to the MS-DOS days of the 80's.
One can tell the difference from the fact that the window title bar says Command Prompt, not Powershell. Often - not always! - a Powershell session has blue background and command has black.
To run Powershell commands, start a Powershell session either by typing powershell and pressing enter into a command session, or by opening Windows Start menu and typing powershell (followed by enter).

How get the all codes which is run previously command line SQL in an Oracle 10G Express Edition?

How can I get all the codes and commands which was executed previously command line SQL of the Oracle 10G Express Edition to new SQL command line?
Like from tempfiles or something else. My OS is Windows.
Here's how I do that:
open CMD
connect to the database using SQL Plus
recall previous commands by pressing the "UP" keyboard key
they are recalled line-by-line, not as a whole command, which means that if you'd like to recall something like this:
select ename
from emp
where deptno = 10
you'll need to press the UP key 3 times
note that - if you want to run the last command (no matter how many lines it spans) - enter slash / at the SQL> prompt and hit the ENTER key
even if you exit SQL Plus, no problem as long as you keep the same CMD window open; just connect again and the same functionality will still be available, in your new SQL Plus session
however, it'll be lost if you close the CMD window
The bottom line is: GUI tools are much more appropriate in this context.

PostgreSQL COPY FROM PROGRAM using ImageMagick

I have 1000 images, and thanks to ImageMagick I can retrieve a lot of information regarding an image by writing "identify -verbose [PATH OF IMAGE]" in the cmd.
I installed ImageMagick with 'legacy on' , to access individual tools rather than the monolithic version of the library.
If I write "identify -verbose C:\\temp\\cbirCorel10k\\1.jpg" in the command prompt it works perfectly, outputting data I need.
My problem is when I insert this code into PROGRAM of PostgreSQL like so :
copy manyline(txt)
from program 'identify -verbose C:\\temp\\cbirCorel10k\\1.jpg'
It gives me this error, and please note that I do have permissions on the image and parent folders to be accessed:
ERROR: program "identify -verbose C:\temp\cbirCorel10k\1.jpg"
failed SQL state: 38000 Detail: child process exited with exit code
1
I want that the output from that command line, is inputted into the table 'manyline' under column 'txt'.
Please note that the following code works well, but I want to make use of the PROGRAM function.
copy manyline(txt)
from 'C:\\temp\\something.txt'
The postgresql server needs permissions to run that program and read that file. it usually runs under username postgres (unless they've changed that recently). this is a "service user" and can be hard to find in the windows GUI; especially on "home" editions of windows. I can't say for sure if granting NETWORK SERVICE access is enough.
easiest solution is to use the psql command-line interface and do
\copy manyline(txt) from program 'identify -verbose C:\\temp\\cbirCorel10k\\1.jpg'
\copy is a psql built-in which runs the command (opens the file etc) as the current user, instead of asking the server to run it. this also works well where the server is not local.

Firebird tools gfix gbak do not launch

Running Firebird 2.5 as a service on a local 64-bit Windows 10 machine.
isql, qli and a bunch of the other tools run just fine.
However when I try an launch gfix, gbak and gstat the window barely opens before disappearing. It does this so quickly nothing is visible.
Any recommendations for dealing with this?
My actual goal at the moment is to change a firebird database from read-only to read-write. Which you can do using gfix http://www.firebirdsql.org/manual/gfix-dbmode.html
If there is some other method to change to read-write I'd happily use it.
The tools gfix, gbak and gstat are command line utilities. They expect certain command line options, and they print their output to the console. If you start them by double-clicking them in explorer, or executing them from the Run prompt, a console is opened, output is written (the usage information as you haven't specified the necessary command line options), and then it exits, closing the console immediately.
This means that if you want to run them and see the output, you need to execute them from the command prompt (cmd), or from a batch-file that has pause at the end.
The fact qli and isql work by opening them from explorer (or run) is because they are interactive tools, waiting for your input.

Command line installer issues

Am attempting to run installer using command line using -c option.
Command line execution appears like this:
E:\dev>MyApp_32.exe -c
E:\dev>This will install App on your computer.
OK [o, Enter], Cancel [c]
E:\dev> (showing the Windows command line is confusing to user)
Welcome .. (text of 2nd screen)
Typing "c" or "Cancel" doesn't work. It always takes enter key as input and proceeds to next screen.
Pressing enter transfers control back to windows's command shell, then back to installer. This looks confusing to user. It doesn't give a unified experience to user.
Is it possible to provide input via a silent file ? i.e. a text file with pre-selected inputs?
Am using 32 bit installer on Win 7 Professional x64 with Java 1.6 installed.
The problem is that the installer is a GUI application, it cannot take control of a WIndows terminal in this way. If you start it via
start /wait MyApp_32.exe -c
the command line prompts will not be displayed.
You can run set a response file with the -varfile argument, see the help for more information.