I used the following on the cmd to try and open the sqlite command line interface, but somehow it is not recognised.
I can see the sqlite db has been created, so cannot see what I am doing wrong:
(env) E:\Python installation\myproject\myflaskproject>sqlite
'sqlite' is not recognized as an internal or external command,
operable program or batch file.
(env) E:\Python installation\myproject\myflaskproject>
I've also tried typing at the prompt: >>sqlite3
Still, the same error.
download slqlit3
to download slqlit3 go to this url: https://www.sqlite.org/download.html
since your are working on windows platform, under Precompiled Binaries for Windows section download sqlite-tools-win64-x64-3320300.zip or sqlite-tools-win32-x86-3320300.zip if your are like me working on the very OLD windows 7 32bit architecture
you have to know sqlite3 is a standalone and executable file meaning sqlite3 don't require to be installed like other programs:
A bundle of command-line tools for managing SQLite database files, including the command-line shell program, the sqldiff.exe program, and the sqlite3_analyzer.exe program.
unzip the downloaded file the under C:\ for e.g. and rename the folder to C:\sqlite3 to make things simple.
now, if you open : C:\sqlite3, you'll find 3 executable files:
C:\sqlite3
sqldiff.exe
**sqlite3.exe**
sqlite3_analyzer.exe
add an Environment Variable
open System Properties (see this post)
go to Advanced tab under System Properties and click Environment Variables
Under System Variables create those variables:
PYTHON_HOME = C:\Python37 (it depends where you already installed python and which version if you have multiple installations)
SQLITE_HOME = C:\sqlite3
go to User variables and add/append variables to PATH like so:
PATH = [..];%PYTHON_HOME%;%PYTHON_HOME%\Scripts;
open new console and check your current active python:
python --version
and then you can use sqlite3 command not sqlite (check the C:\sqlite3 installation folder):
(env) E:\Python installation\myproject\myflaskproject>sqlite
'sqlite' is not recognized as an internal or external command,
operable program or batch file.
(env) E:\Python installation\myproject\myflaskproject>sqlite3 -version
3.15.2 2016-11-28 19:13:37 bbd85d235f7037c6a033a9690534391ffeacecc8
now you can open the sqlite database file (e.g: data-dev.sqlite3 under /myflaskproject ) like
(env) E:\Python installation\myproject\myflaskproject>sqlite3 data-dev.sqlite3
SQLite version 3.15.2 2016-11-28 19:13:37
Enter ".help" for usage hints.
sqlite>
some quick useful sqlite commands
sqlite> .databases
seq name file
--- --------------- ----------------------------------------------------------
0 main E:\Python installation\myproject\myflaskproject\data-dev.sqlite3
sqlite> .tables
user
sqlite> .exit (to exit)
for more about sqlite have look at this site sqlitetutorial.net
Related
I downloaded Instant Oracle Client Version 11.2.0.4.0(basic, sqlplus, devel .rpm file) by Oracle website in Ubuntu.
After converting .rpm into .deb using alien, I installed it, basic first and sqlplus and last devel.
And then I tried to run sqlplus.
But It is saying sqlplus64: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
Even though my PATH contains the PATH.
The below shows my PATH and the location of libsqlplus.so.
A#ubuntu:~$ sudo find / -name libsqlplus.so
/usr/lib/oracle/11.2/client64/lib/libsqlplus.so
A#ubuntu:~$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/sangmin/eclipse:/usr/lib/oracle/11.2/client64/lib:/usr/lib/oracle/11.2/client64
Test your Oracle client. User either sqlplus either sqlplus64 depending on your platform. In my case, I used:
$ sqlplus64 username/password#//dbhost:1521/SID
If you get the next message, then you need to instruct sqlplus to use the proper libray:
sqlplus64: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory.
To do so, first find the location of Oracle libraries. The path should be something like /usr/lib/oracle/<version>/client(64)/lib/. In my case (Ubuntu 14.04 LTS, Intel on 64-bit), it was /usr/lib/oracle/11.2/client64/lib/.
Now, add this path to the system library list. Create and edit a new file:
$ sudo nano /etc/ld.so.conf.d/oracle.conf
Add inside the path:
/usr/lib/oracle/11.2/client64/lib/
Run now the dynamic linker run-time bindings utility:
$ sudo ldconfig
If sqlplus yields of a missing libaio.so.1 file, run:
$ sudo apt-get install libaio1
For other errors when trying to run sqlplus, please consult the Ubuntu help page.
Might worth checking the permissions issue:
sqlplus: error while loading shared libraries
PERMISSIONS:
I want to stress the importance of permissions for "sqlplus".
For any "Other" UNIX user other than the Owner/Group to be able to run sqlplus and access an ORACLE database , read/execute permissions are required (rx) for these 4 directories :
$ORACLE_HOME/bin , $ORACLE_HOME/lib, $ORACLE_HOME/oracore, $ORACLE_HOME/sqlplus
Environment. Set those properly:
A. ORACLE_HOME
(example: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/)
B. LD_LIBRARY_PATH
(example: ORACLE_HOME=/u01/app/oranpgm/product/12.1.0/PRMNRDEV/lib)
C. ORACLE_SID
D. PATH
export PATH="$ORACLE_HOME/bin:$PATH"
I need to convert from sqlite2 db to sqlite3, is there any tutorial that shows how to do it? And if I migrate correctly what to expect as I start the project?
The SQLite website says:
sqlite OLD.DB .dump | sqlite3 NEW.DB
where sqlite is version 2 and sqlite3 is version 3.
Converting an SQLite2 database to an SQLite3 database on Windows
-- Step-by-step instructions --
1- Download SQLite2 and SQLite3 command-line tools
Download links:
sqlite.exe
http://web.archive.org/web/20031203050807/http://sqlite.org/download.html
(Precompiled Binaries For Windows)
sqlite3.exe
http://www.sqlite.org/download.html
(Precompiled Binaries for Windows)
2- Copy sqlite.exe, sqlite3.exe and the db to convert to the same folder (i.e.: D:\TEMP)
3- Open a Windows command prompt ( [WINDOWS KEY] + [R], then type "cmd" or via the Start Menu)
4- Browse to the folder where you've just copied the files (i.e.: type "D:", then "cd temp")
5- Type "sqlite OLD.DB .dump | sqlite3 NEW.DB" (without the quotes), where OLD.DB is the db file you want to convert and NEW.DB is the name of the converted file that will be created.
Hope this helps.
EDITED: ANSWER TO THE QUESTION
To the conversion
Go to http://www.sqlite.org/download.html
Download sqlite-dll file (which stays in Precompiled Binaries For Windows)
Unpack it and copy to C:\Windows\System32 folder
What are the differences? (quoted from PHP - SQLite vs SQLite3)
SQLite2 internally stores every value as a string, regardless of its type.
Upgrading to SQLite3 will certainly shrink the database size since numbers and BLOBS get stored in their native formats, which could make things run faster.
starting from 3.6.23 version it supports foreign keys.
I downloaded the binaries for windos for sqlite and extracted them. There were three files
a shell
dll
analyzer
when I try to run to create a database and a table from the sqlite shell i get....
SQLite version 3.7.8 2011-09-19 14:49:19
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> sqlite3 test.db
...> create table tbl1(one varchar(10), two smallint);
Error: near "sqlite3": syntax error
sqlite>
when I try to run to create a database and a table from the command line(Vista) shell I get....
Microsoft Windows [Version 6.0.6000]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\codenamejupiterx>sqlite3 test.db
'sqlite3' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\codenamejupiterx>
does anyone have any ideas?????
There is no "installation".
The error is that "sqlite3.exe" was not found in the search path as defined by the (Windows) PATH environment variable. Either add it to %PATH% (see How do I set or change the PATH system variable?) or use a complete file qualification that does not rely on %PATH%. A fully qualified invocation may look like:
C:\path\to\sqlite\sqlite3.exe test.db
Running sqlite3 by "double clicking" the executable in Windows Explorer is the same as above [as it uses an absolute path to run the sqlite3 executable] -- albeit without the ability to specify the database name or other options. (These can be specified in a "shortcut" to sqlite3, if desired.)
Happy coding.
You run the command sqlite3 test.db to start the sqlite shell. (your first example) From in there, you do not need that part of the command again, just issue the "create table " command.
I think you need this:
SQLite-1.0.66.0-setup.exe And sqliteadmin to open sqlite database
Regards
I have my sqlite3.exe file in C:\ and i want to create an sqlite database in C:\db\sqlite.I have tried sqlite3 ex1 as suggested on the docs http://www.sqlite.org/sqlite.html but i get the error Error Near "sqlite3".
What is the correct way of creating a new database from the shell?.
Here is one way to use SQLite3 from the command prompt in Windows.
First you need to know the path to the folder where you installed the SQLite ODBC Driver. If you used the default settings this would be C:\Program Files\SQLite ODBC Driver on Windows XP
Go to Start -> Run -> type cmd -> click OK
This opens the command prompt.
In the Shell, type in the following command. You can use Alt + Space if you prefer to use cut and paste. Remember to modify the path for your setup if you installed SQLite in another folder.
cd C:\Program Files\SQLite ODBC Driver
This brings you to the SQLite install folder. Now you are ready to call SQLite. Type the following command at the SQLite prompt.
sqlite3
This opens the File menu where you can choose a database to connect to, or create a new database file.
Navigate to C:\db\sqlite and create myDatabase.db, and click Open to close the file menu.
Now you are ready to work on your new database, run your queries, e.g. create a table.
As new file is created in current directory, for creating file at different location you should follow this format:
eg. for storing file FILENAME.db at c:/users/xyz/abc
you should type
sqlite>.open c:/users/xyz/abc/FILENAME.db
and then press enter a new file will be created at the mentioned path.
and now when you will type .databases you will see your file listed in the list of databases.
You can use following command to create the sqlite database
.open databasename.db
or
.open c:/somefolder/databasename.db
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.