I just installed sqlite3 and added it to environment.
I am now able to open to run sqlite3 from CDM. I can open database. However when I add database command .schema does not work and returns nothing. Can somebody please help to explain what is happening?
However if I open CMD and provide path of sqlite3 and open sqlite3.exe and provide name of database then it magically works. What is the reason for that?.
For some reason I need to provide a a path to sqlite3 then open sqlite3 and then it adds database correctly. Database and sqlite3 are in the same place.
Should it not work when full path of sqlite3 is added to environment?.
If you look in C:\Users\Chata there’s a file acs-1-year-2015.sqlite there because that’s what you told sqlite to open. (it even says so in your screenshot)
You told it to open two different files.
If you want to open a file somewhere other than in your current directory then you would need to provide an absolute path to that file, not just the base name.
Your PATH variable is unrelated to this.
I was under impression it would work as a relative path as SQLite and database are in the same place.
I thought if I provide SQLite path in environment , then I can open databases in relative directory by just providing the name of data base as both are in the same place.
Also how can I open it once in SQLite3?. By providing full path as in example below doesn’t work.
Full path or database name does not work with .open.
The problem isn’t that sqlite can’t read a path, the problem is your path is invalid. It echo’d it back to you, note what happened to the backslashes. Presumably you would need double backslashes, backslash is a common character used for escape sequences.
If you do not supply full path then yes, the location you are then specifying is relative to YOUR location. Not to the executable’s location, that’s irrelevant.
What is the point of providing full path of SQLite to environment if I cannot open database file by providing full path of it afterwards with .open command or just a name of the file?.
Double backward slashes didnt work, but forward slashes worked!
I was doing it wrong all the time as CMD path can be done with backward slashes.
Would you know what is the command to change current directory?. I would really want to make it work with relative path and thought that environment path would do this.
If you’re going to use a commandline shell you might wanna consider using something other than windows, if you take a look in windows store there’s an app there named ubuntu… ubuntu is a linux distribution, an operating system, a list of programs ready to be downloaded and installed.
That’s pretty darn close to a linux system (with the difference that … well it probably dosen’t have linux in it, instead running on the windows kernel … I think), you only get a terminal but that’s also the only thing you’d ever want.
To install sqlite in that you would do something like:
(which is three commands to be run in sequence)
the first one updates the package index, the second one syncs local packages with that package index, the third installs the sqlite3 package
It’d take a while because it’s equivalent to a full system update and a newly installed system might have a couple things to catch up on… but after that you would have sqlite3 ready to be run:
$ sqlite3
SQLite version 3.31.1 2020-01-27 19:55:54
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite>
(it’s basically a virtual machine, separate from your system, hosted by your system. file access goes through the network, there’s some special network directory for that)
The reason you might want to do that is because while you’re using windows you’ll probably end up using a whole lot of workarounds more complicated than the thing you’re trying to do.
And, well, installing things is one command (apt install <package>), there’s no silliness like going to a website and downloading it with your browser and running a graphical installer and so on
But you might also not really have a need for a commandline shell in which case… whatever. But if you do, it should probably be this, not anything inside windows.
Isn’t the M in that for mariadb? (which is a MySQL fork)
vscode is an editor… I guess you would want an editor… right? but yeah, that is probably the only editor that can be easily recommended to other people (I don’t use it, but if I wasn’t using the one I do that’s probably what I’d use)
there is almost certainly a package containing mariadb and/or mysql in ubuntu, you’d do something like