Translate Connection String H2 (JDBC) to MySQL (JDBC)

0

Personal speech,

I'm trying to run the OW2 Orchestra software, and it comes with a default connection string belonging to H2 in the following format:

jdbc\:h2\:file\:/tmp/orchestra-db/orchestra_core.db

I need to translate it to a MySQL string (also JDBC), something like:

jdbc:mysql://localhost:3306/

With the same information of the original string.

The problem is that I did not quite understand what the original string means! Can anyone help me?

    
asked by anonymous 14.11.2016 / 20:30

1 answer

0

'jdbc: h2: file: /tmp/orchestra-db/orchestra_core.db' follows the format:

  

jdbc: h2: file: [path]

Where:

  • jdbc: is a fixed string
  • h2: is the name of the driver used, in this case the driver for DB H2.
  • file: tells H2 that you are using a local DB
  • path , in this case '/tmp/orchestra-db/orchestra_core.db', indicates the path of the DB.

What should be confusing you are these bars ('\') that appear in your question. They are used to escape special characters, I believe.

Basically everything this url says is:

  

Use a local DB that is in the file '/tmp/orchestra-db/orchestra_core.db'.

If you want to set up a similar mysql url just point to localhost, depending on your example:

  

jdbc: mysql: // localhost: 3306 /

Note: You will have to choose which port mysql will run on.

    
14.11.2016 / 20:55