SQLite3 : How to create db via code? - database

In my cocoa application, I am including a SQLite3 db. General process is:
I check if database with same name exists in Documents folder.
If it does not exist I copy it from application binary to Documents folder.
My question is:
Can we directly create db via code, if
it does not exist.. something like
create db xyz ?
Thanks,
Miraaj

Related

How to load data from UNIX to snowflake

I have created CSV files into UNIX server using Informatica resides in. I want to load those CSV files directly from UNIX box to snowflake using snowsql, can someone help me how to do that?
Log into SnowSQL:
https://docs.snowflake.com/en/user-guide/getting-started-tutorial-log-in.html
Create a Database, Table and Virtual Warehouse, if not done so already:
https://docs.snowflake.com/en/user-guide/getting-started-tutorial-create-objects.html
Stage the CSV files, using PUT:
https://docs.snowflake.com/en/user-guide/getting-started-tutorial-stage-data-files.html
Copy the files into the target table using COPY INTO:
https://docs.snowflake.com/en/user-guide/getting-started-tutorial-copy-into.html

missing the database

I have a problem with my database which is base on access. when i try to use insert command, all records send to mydatabase.mdb in root folder, but when I want to read from database, records come from another database which is in bin folder.
it cause a big problem because every time I should copy mydatabase.mdb from root folder to bin folder !!!
how I can solve this problem?
P.S.
I use the same connection string in both insert and select command.
public OleDbConnection con = new OleDbConnection(#"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\\fanoos\\new work\\C# regester_markaze tebi\\regester\\regester\\bin\\Debug\\Db_reg.mdb");
It sounds like your database has linked tables which are pointing to the "other database which is in the bin folder". Open the database you are connecting to in Access and use the linked table manager to see where the linked tables are pointing. In Access 2010+ (and maybe 2007+) the linked table manager is located on the External Data ribbon tab.

How to use a persistent H2 database in the Play Framework instead of in-memory

The H2 database used in the Java Todo List tutorial is the following:
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
How do I modify the configuration file to use a persistent database as opposed to an in-memory version. Do I need to setup an entirely separate DB or can I modify the db.default.url property?
I'm using Play! 2.0.3.
I found the solution.
To create a file database, modify the following:
From
db.default.url="jdbc:h2:mem:play"
To
db.default.url="jdbc:h2:file:data/db"
Where data/db is broken down into:
data/ The folder location of the database files relative to your project root.
db The name of your database files.

executing EntityFramework4Domain.edmx.sql

I'm creating an application that uses Entity Framework 4 as the ORM. I'm using the designer and have generated the Domain.emdx.sql file to create the database.
So far, I've just run that edmx in sqlserver manually to create the db, but I'm now working on a lightweight installer and I'd like to connect to the db if it exists and run the sql script to create the database, after which I'll use my repositories to insert all of the default values that the db should be populated with.
I would like to be able to load the edmx.sql file so that it will always take the most current changes without having to copy the contents of that file into some resource manually, but I can't seem to find out how to get at its contents in code. It's not in the build folder and it doesn't appear to be directly accessible in code.
How might I do that?
You can try using the CreateDatabaseScript method. It will provide you with the script.
However, looks like you need the CreateDatabase method of the ObjectContext class, this method will simply create a database.

SQLite database file created from JDBC?

I have created a SQLite database from Java. Now I want to know where it is stored physically on disk, so that I can push that file on to Android.
You specified a database name as part of the JDBC connection URL. Look for a file with that name on your harddisk. Example:
jdbc:sqlite:test.db
-> look for test.db
SQLite usually produces one file with the extension .sqlite, but this is just convention, the extension can be anything.
As already was said, the code which opens the database spefifies the path where the file should be stored, so you have to look there.

Resources