SQLite attach all databases in a directory - database

Hi I have an sqlite database called 'main.db' where I attach all the databases that are in the directory 'db' (e.g. 'db/db1.db' , 'db/db2.db' and so on).
I would like to know if there is a way to save 'main.db' so that the attachements are remembered across sessions.
Also when in 'main.db' how can I create a new database 'db/db3.db' and have it attached automatically when I open 'main.db'?
I usually use the sqlite3 shell for my databases maintenance.

Attachments are not stored in the database; they are local to a connection.
Any attachments must be done explicitly by the application that has opened the database.

Related

how to mirror a whole database cluster in postgresql

I'm using a postgresql (9.6) database in my project which is currently in development stage.
For production I want to use an exact copy/mirror of the database-cluster with a slightly different name.
I am aware of the fact that I can make a backup and restore it under a different cluster-name, but is there something like a mirror function via the psql client or pgAdmin (v.4) that mirrors all my schemas and tables and puts it in a new clustername?
In PostgreSQL you can use any existing database (which needs to be idle in order for this to work) on the server as a template when you want to create a new database with that content. You can use the following SQL statement:
CREATE DATABASE newdb WITH TEMPLATE someDbName OWNER dbuser;
But you need to make sure no user is currently connected or using that database - otherwise you will get following error.
ERROR: source database "someDbName" is being accessed by other users
Hope that helped ;)

How to share access 2016 database with multiple user

I migrated my access 97 databases to access 2016 & want to share the database with multiple users having READ/WRITE simultaneously. I kept MS Access 2016 in shared mode and my database in NTFS shared folder in my network.
Even Access is in shared mode when one user is trying to save their changes i am getting this error
Microsoft Acess can't save design changes or to save to a new database object because another user has the file open. To save your design changes or to save to a new object, You must have exclusive access to the file
Suggest me how can i share the database
Thank you :)
Development/Design cannot be shared on the same file. There are steps that need to be done to accomplish this if you have more then 1 developer.
If you are having multiple users update data in the database, split your database using the Database tools > Access Database (Under Move Data tab). This will ask you where you want to save the backend of your file. Choose the file path where you want to save the file.
Take the front end and either email to all your users, or place in a folder location on the share drive for everyone to copy the front end to their desktops.

sql file stream PathName dosent show in window fileExplorer

I have a file Stream Sample database , I have added records into table.
When I use file.PathName() my sample project in c# SqlFileStream class recognize this address and retrieve my file but did not show in windows file Explorer?
What is this address? Is it fake address?This class may look at FileGroup path for finding real address?if not how this class find path?
\ComputerName\SQL2016\v02-A60EC2F8-2B24-11DF-9CC3-AF2E56D89593\FileStreamTestDB\dbo\BLOB_Table\FileData\00953530-2F65-4AC9-81E9-0281EFB89592\VolumeHint-HarddiskVolume3
Data in a FILESTREAM column are stored inside of the database. You can see the internal files stored in the database by browsing the local file system FILESTREAM filegroup directory but that path is not exposed for remote access and shouldn't be used at all. You'll need to use SqlFileStream to get a handle for access to FILESTREAM data via the Win32 API.
If you want to access files stored in the database via Windows Explorer or any other application, consider using Filetable instead. A FileTable leverages FILESTEAM internally but exposes the files stored in the table via a UNC path for non-transactional access. That allows files to be added/change/deleted via the share just regular files or with T-SQL INSERT/UPDATE/DELETE statements. In both cases, the changes are stored in the database FileTable and reflected in the FileTable directory share too.

difference between .dbo and .mdf database

I am really new to database and I am using visual studio 2010. From what I know, there are two ways of creating a database. The first is to right clicked on the project and select Add->New Item and then in the Add New Item dialog I select the Service-based Database which creates a mdf file that lies locally in my project.
Alternatively, I can also create a database in the following way. Right click on the DataConnection in Server Explorer and select Create New SQL Server Database. The created database is shown in server explorer as homepc\sqlexpress.myCreatedDatabase.dbo.
So my question is what is the difference between this two databases (mdf and dbo) and will there be any differences that might occur after I release my project, install and run it on other pcs?
.DBO is the database owner while
.MDF is the manifest data file which is the actual database file.
The primary data file contains the startup information for the database and points to the other files in the database. User data and objects can be stored in this file or in secondary data files. Every database has one primary data file. The recommended file name extension for primary data files is .mdf.(see msdn)
for more info see the forum here DBO or MDF whats the diffrence?

open an existing sqlite database - HTML5

I am trying to access an sqlite3 DB from an HTML5 page. The DB is found the physical folder. How to open the DB. All the sample in net describes window.openDatabase() method. This is creating a new db instance. How to open an existing database.
thanks in advance
Geervani
When you tried to use "window.openDatabase()" on an existing database, what happens to the data?
My guess is "window.openDatabase()":
creates the DB is not existent,
then use it use it if it exists

Resources