Is the configuration format for Sponge's SqlService ambitious?

Sponge’s SqlService provides managed JDBC DataSources to clients. A DataSource is requested by providing the configuration as String. The format of this String is defined as follows:

jdbc:<engine>://[<username>[:<password>]@]<host>/<schema>

I might be wrong, but it seems to me that this is problematic: schema may be omitted because not every supported DBMS requires one (they are optional for H2, and not supported by SQLite). However, in these cases host may still include slashes as the the host is a path to file on the system.
Therefore Sponge is unable to know whether a database is given or not.

For example, look at this:

jdbc:h2:username:password@./path/to/dabase/file

Sponge should connect to a H2 database file under ./path/to/dabase/file that does not use any schema. Instead, it seems like Sponge connects to a database file under ./path/to/dabase/ with the schema file.

Even worse for SQLite:

jdbc:sqlite:./path/to/dabase/file

It seems to me that Sponge also tries to parse file as a schema even if SQLite does not support schemas.

I haven’t tested this myself (mostly because I have no Sponge server running), but just read through the implementation of SqlService. So before reporting this: Is my observation correct?

1 Like