Hello,
I have a problem. I want to create temporary linked table, where urlString is set in variable before this this create command. Both databases are H2, both are file based. See example below:
set @pathTo_applicationFolder = regexp_replace(database_path(), '(.*/)database/([a-zA-Z0-9]+)', '$1');
select @pathTo_applicationFolder;
set @pathTo_database = 'jdbc:h2:file:' || @pathTo_applicationFolder || 'database/aaa';
select @pathTo_database;
create temporary linked table
"SHARED_GLOBAL_STATISTICS3" (
'org.h2.Driver'
,'jdbc:h2:file:C:/Users/xxx/Desktop/APPS/bbb/database/aaa'
,''
,''
,'"STATISTICS"."GLOBAL_STATISTICS"'
)
;
create temporary linked table
"SHARED_GLOBAL_STATISTICS" (
'org.h2.Driver'
,@pathTo_database
,''
,''
,'"STATISTICS"."GLOBAL_STATISTICS"'
)
;
The result of "select @pathTo_database;" is "jdbc:h2:file:C:/Users/xxx/Desktop/APPS/bbb/database/aaa".
Why the second CREATE statement fails with the error below? I do not want to have hard-coded path to the database, as in the first CREATE statement. The linked database has no username, nor password.
Error: Syntax error in SQL statement "create temporary linked table
""SHARED_GLOBAL_STATISTICS"" (
'org.h2.Driver'
,@pathTo_database
,[*]''
,''
,'""STATISTICS"".""GLOBAL_STATISTICS""'
)"; expected "string"; SQL statement:
create temporary linked table
"SHARED_GLOBAL_STATISTICS" (
'org.h2.Driver'
,@pathTo_database
,''
,''
,'"STATISTICS"."GLOBAL_STATISTICS"'
) [42001-200]
SQLState: 42001
ErrorCode: 42001
Thank You in advance for Your help. Stepan