datasource template not passing user configuration values

I am having h2 configuration issues where I suspect it is an Intellij url template reading/mapping problem.  My h2 configuration is set to NOT capitalize things but it does it anyways.  I feel like I have done my part but the IDE is not adding the parameters to the connection url.  I have the impression that using the default 'remote' h2 template, it would add my user parameters and variables to the connection url but it does not appear to be doing that.  Can you please advise whether my understanding is wrong or if this is an issue with the tool?

Screen shots provided below.

Thank you!

10 comments
Comment actions Permalink

And what is the issue exactly? It does not supposed to add all parameters you change in UI to the connection URL, but they are passed to database, definitely.

0
Comment actions Permalink

I don't it does pass it to database.  How are you confirming definitely?  I was able to get it working by extending the url locally but it I feel it definitely ignores the identifier/param values.  I am interested in knowing how you are confirming what is sent to the database?  I was thinking about trying wireshark.

0
Comment actions Permalink

which parameters seems to be ignored?

 

0
Comment actions Permalink

DATABASE_TO_UPPER=false is ignored.  I also expected a 'bad parameter' error for 'hey'.

0
Comment actions Permalink

What is the template syntax?  I doesn't look right to me.

jdbc:h2:tcp://{host::localhost}[:{port::9092}]/{database::default}[;<;,user={user:param},password={password:param},{:identifier}={:param}>]

I'm guessing it would want to iterate the identifier and params, but they should be seperated by semi-colons.  I don't know the syntax being used but that may be worth checking.

0
Comment actions Permalink

I looked at the connection information on wireshark and I do not see anything related to {:identifier}={:param}.  Are you sure it works?

0
Comment actions Permalink

properties on 'Advanced' tab and  in URL are independent, and both are passed to driver. what exactly and where you specified? how do you know it does not work? What are expected  and actual results? do you run any specific query to database which does not work as expected?

0
Comment actions Permalink

Essentially, I am using all lowercase names for my table and schema names because I plan to switch out H2 for postgres.  And postgres can certainly use uppercase but it prefers lowercase.  I am also using JPA, flyway, and spring-data which means that I am not writing any sql in spring and only a little bit for the flyway migration .sql files.  The H2 driver default settings will uppercase everything, which is generally fine, except that I do not want that in this situation since I am migrating to postgres.  The driver setting to disable the uppercase, DATABASE_TO_UPPER=false, will turn this feature off.  If you manually type this into the h2 url, in application.properties and the Intellij Datasource h2 url, it will work.  But the Datasource advanced tab configuration seems to imply that you can provide these settings there and they will be passed to the Intellij H2 Console connection, along with the Intellij database screen which shows you the db layout etc...  

Ultimately, the Intellij integration with the H2 Datasource does not appear to pass the values from the 'Advanced' tab.  So I am not sure what the purpose of the 'Advanced' tab is and how it relates to passing values to the H2 Driver.

I will add an example project to github later this morning, for comment.

Also, Thank you for looking into this!  I appreciate your time!

Best regards!

James

0
Comment actions Permalink

Hi Yuriy,

I have created a project at https://github.com/ricejamesh/h2-flyway-demo which works fine with h2, yet the Intellij h2 datasource has problems referencing the h2 server running at h2:tcp:\\localhost due to capitalization issues.

0
Comment actions Permalink

Everything seems to work if I append ";DATABASE_TO_UPPER=false;DATABASE_TO_LOWER=true" to the urls (and not the advanced tab).  This includes the spring application.properties, the H2 browser client, and the Intellij DataSource configuration.  However, the first connection to the database sets the capitalization for the initial schemas and tables, so once it starts off wrong, there doesn't appear to be an easy correction for it.  Now all schema and table names are in lower-case.

 

0

Please sign in to leave a comment.