Bug 44069 - Request: Environment-variable like macros for ODBC/ADO/JDBC connection strings
Summary: Request: Environment-variable like macros for ODBC/ADO/JDBC connection strings
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
Master old -3.6
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Connectivity
  Show dependency treegraph
 
Reported: 2011-12-22 10:09 UTC by Kurt
Modified: 2016-12-19 17:06 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kurt 2011-12-22 10:09:39 UTC
Deploying a file-based Base database that doesn't use the internal HSQLDB connection can be difficult.  The connection string for external databases normally requires a full path to the database, DSN file, or similar.  Being that different users can deploy the databases to different directories, and even to different platforms, this requires manual configuration by the user of sometimes esoteric database settings.

For example, a Base database I recently deployed connects to a SQLite database.  I used a DSN-less ODBC connection so the end user didn't have to create an ODBC DSN to use the database.  However I still had to use Base's ODBC "Optional Settings" to specify the database file by setting it to:
  "Database=C:\Users\Kurt\Documents\Creative\Pathfinder Spell Database.db".

The end user doesn't have to create a DSN, but the user does have to edit the Base database connection to edit the ODBC "Optional Settings" to give the location on the user's system of the back-end SQLite database.

I propose inclusion of a system similar to environment variables that will allow inclusion of "macros" in connection strings that expand to different things.  In the above example, the ODBC "Optional Settings" might read:
  "Database=%DOCPATH%\Pathfinder Spell Database.db"

In the above example, "%DOCPATH%" would be evaluated by LibreOffice and expand to the directory that the document resides in.  This will allow a database to be deployed where, if the database file is kept in the same directory as the Base .odb document, the user doesn't have to do anything extra to connect to the database file.
Comment 1 sasha.libreoffice 2012-05-02 08:18:39 UTC
Thanks for new idea
> if the database file is kept in the same directory as the
> Base .odb document, the user doesn't have to do anything extra to connect to
> the database file.
May be allowed relative path like this:
./Pathfinder Spell Database.db
inside of odb file. And if not allowed, may be it is a bug?
And may be possible to place file-based-database into odb file (embed)? Especially if database file is small, it would be more simply for user to use such all-in-one odb.
Comment 2 Alex Thurgood 2015-01-03 17:40:52 UTC
Adding self to CC if not already on