I use the command line sqlite3 executable to check queries I make from my code.
Is there a way to read in pragma statements or other session setup (".mode csv" for example) when the executable starts up?
I know I can do a ".read " once I'm in, but that's tedious.
Put a .sqliterc file in your home directory with
the commands you want executed each time you start
the sqlite3 command line tool.
Unix and Linux use ~/.sqliterc; Windows tries to find the
location of .sqliterc using the environment variables
USERPROFILE HOME HOMEDRIVE and HOMEPATH.
Related
I am trying to execute a simple db2 command in Linux command prompt. but Linux command prompt is not recognizing the command it is giving - bash db2 command not found. but db2 is installed in the Linux machine.
command I am trying to execute from Linux command line processor is db2 "create database smaple"
Error I am getting is below "If db2 in not a typo you can run the following command to lookup the package that contains the binary" command-not-found db2 -bash: db2: command not found"
Is this because of environment variable problem ?? or there is only one instance of db2 ie db2inst1 is running in the machine.my user name in appsusr and db2 instance name is db2inst1 are different is this causing problem?? and I am not having super user access.Is this is causing any problem?? do I need super user access is required ??
Just type, echo $PATH in your command prompt , where you can see all the exported paths in your system.
If the db2 path is not found in your environment variable list, then do the following.
export PATH=$PATH:/opt/IBM/db2/V10.1/bin
and then press enter.
I hope this will resolve your issue.
On Linux and UNIX DB2 platforms, the proper way to set your environment variables to run DB2 commands is to source the sqllib/db2profile script belonging to the local DB2 instance owner. That will set not only your PATH but also other important variables that DB2 requires.
In your case, the instance is owned by the db2inst1 user, so your login startup file or batch script should run this command:
. ~db2inst1/sqllib/db2profile
The leading dot is necessary to set the variables in your current shell process, not the sub-process that quickly vanishes after db2profile finishes.
It's more than likely that, if DB2 is installed, it's simply not in your path.
Your path should contain something like:
/opt/IBM/db2/V10.1/bin
which is where the executables live (depending on which version you're running).
Changing your path will probably entail changes to one of the startup files, such as .bashrc or .bash_profile.
I am new to SQLite3.
I am trying to create a DB in the shell. When I run the shell, it already shows:
SQLite version 3..
Enter ".help" for instructions ..
Enter SQL...
Enter SQL statements terminated with a ";"
I read somewhere that I should be able to type "$" and codes like "$ sqlite3 mynotes.db"
Now, I need to be able to name my DB (like "mynotes.db") and be able to decide in which folder I want it to be saved.
Can someone help me? Cheers!
The $ somewhere was supposed to be a prompt of some shell (command processor), where you start sqlite3 and specify database name (which is created if does not exists).
If you're running sqlite3 without a shell (by clicking on sqlite3.exe?), it's time to try another way. CMD.EXE on Windows is as good for this job as a typical Unix shell.
As of the folder where the database will be: either cd to this folder before you run sqlite3 mynotes.db, or specify full pathname to the database: sqlite3 "C:\Users\Me\Documents and Settings\mynotes.db" (double quotes are needed when argument contains spaces).
When sqlite3 is started with no parameters, the database will be in memory. Sqlite3 supports "attaching" other databases (see ATTACH DATABASE description). This way, you can create and open on-disks databases even if starting sqlite3 with parameters is impossible for some reason (or too hard).
I want to do some things with sqlite3.exe, the sqlite3 command line shell. After navigating to the directory in PowerShell ISE, I run the program with .\sqlite3.exe and get the expected output from SQLite:
___________________________________________________________
PS [path]\SQLite shell> .\sqlite3.exe
SQLite version 3.7.14 2012-09-03 15:42:36
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
However, if I try typing .help after this, or any other command for that matter, nothing happens and the bottom taskbar says "Already running a command. Please wait.". Of course, there is nothing to wait for, because clearly sqlite3.exe is waiting for input from me.
I cannot get PowerShell ISE to respond to any further commands after this point unless I quit SQLite with Ctrl+Break.
What is wrong?
The problem is Powershell ISE isn't like the normal Powershell console. Powershell ISE is a host built on WPF which you'll find certain legacy exe commands do not work correctly in ISE. These are normally interactive exe commands and not just sqlite3.exe. For example I've had issues with logparser.exe in ISE also.
Try running it in poweshell.exe
OS: UNIX Solaries, Oracle Application Server 10g
To run shell script from Oracle Forms, I used the following host('/bin/bash /u01/compile.sh') and it works well
Now, I need to run unix command something like
host('mv form1.fmx FORM1.FMX') but it's not working
I tried to append the command mv form1.fmx FORM1.FMX' to the compile.sh shell script but also it's not working although the rest lines of the shell script is running well
The solution is to just add the full path of the mv command and it worked well, as follow
/bin/mv /u01/oracle/runtime/test/form1.fmx /u01/oracle/runtime/test/FORM1.FMX
In case anyone else encounters the same problem, the cause is that Forms process creates a subprocess to execute host() command, and that subprocess inherits environment variables of the parent process, which are derived from default.env (or other env file as defined in server config). There is a PATH variable defined in that file, but it doesn't contain usual /bin or /usr/bin, so the commands will not execute unless full path is specified.
The solution is to set the correct PATH variable either in the executed script (via export PATH=$PATH:...) or in default.env. I set it in the script, since, knowing Oracle, there's no guarantee that modifying default.env won't break something.
The documentation states that there is a command-line shell for sqlite3:
To start the sqlite3 program, just type "sqlite3" followed by the name the file that holds the SQLite database."
When I try this, in the Windows Command Prompt I get the error message:
'sqlite3' is not recognized as an internal or external command,
operable program or batch file.
Windows explorer reveals several 'Sqlite3" folders in various places:
backends(C:/Python26/Lib/site-packages/django/db)
Lib(C:/Python26)
backends(C:/Django-1.1.1/Django-1.1.1/build/lib/django/db
backends(C:/Django-1.1.1/Django-1.1.1/django/db)
How do I access the shell, can anyone help?
Download sqlite3 binary for windows here. Unzip it and put it somewhere in your path.
That's the error message you get if you try to run any executable that's not in your current directory or in the path.
To correct the problem, find the SQLite executable (SQLITE3.EXE), and run it from the directory in which it resides, or add SQLITE3.EXE to your PATH environment variable.
You have to properly set your PATH environment variable to include one of the locations where sqlite3.exe resides. Usually SQLite seems to set that environment variable upon install but the list of paths where you found it indicates that it just came as a library for various other applications. Therefore it's not too surprising that the path isn't set.
I have sqlite3 on my machine, and as others have mentioned it must be located within a folder specified by your PATH environment variable. Since I use it a lot, I threw it in windows\system32, which is where I place a lot of utilities like pstools.