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 


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/06e31db1-2340-4635-89a9-123d17eab926%40googlegroups.com.

Reply via email to