Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database Location in Scheme

I have a program which make use of a local database (sqlite3 and i use db module). What i want to do is using the database without knowing where it is.

For example, if i code the location of database in my program (like C:/my documents/my program/localdb.db), it is working correctly.

But if i just write "localdb.db", it doesn't find the database even if database is in the same folder with the .rkt file which use the database. (i dont know how but in earlier versions of my program, it was working).

Thus, how can i ensure to use the database without coding its location?

Thanks a lot!

like image 726
Asqan Avatar asked Aug 12 '13 17:08

Asqan


People also ask

What is the default schema for a new database?

dbo is the default schema for a newly created database. Schema ownership can be transferred from one user to another user in the same database. A database user can be dropped without dropping the database objects owned by the user. But the schema cannot be deleted if it owns database objects. A schema can be created using T-SQL.

What is a physical database schema?

Physical database schema: The physical database schema describes how data will be stored physically on a storage system and the form of storage used (files, key-value pairs, indices, etc.).

What are the built-in schemas in SQL Server?

SQL Server provides us with a few built-in schemas such as dbo, guest, sys, etc. A database schema can be owned by a database role or an application role along with the database user. They are called schema owners. dbo is the default schema for a newly created database.

What are the different types of database schema?

While the term schema is broadly used, it is commonly referring to three different schema types—a conceptual database schema, a logical database schema, and a physical database schema. Conceptual schemas offer a big-picture view of what the system will contain, how it will be organized, and which business rules are involved.


1 Answers

Instead of "localdb.db", try using a runtime-path like this:

(define-runtime-path localdb "localdb.db")

and use localdb in place of the path string. You'll need to (require racket/runtime-path).

like image 189
Asumu Takikawa Avatar answered Oct 21 '22 14:10

Asumu Takikawa