Are you able to check you have the entire contents of the *lib* directory
in tact from the migrator tool distribution
<https://github.com/gocd/gocd-database-migrator/releases/tag/1.0.0-39> ? it
looks like you might be somehow missing *lib/h2-1.4.200.jar* or it cannot
be found/loaded by Java.

For what it's worth, you shouldn't need to do anything elevated here, as
long as you have read permissions to the source H2 database file (which you
have implicitly specified is available at* /h2/cruise.h2.db* in the below
command.

On Mon, Sep 5, 2022 at 4:40 PM Tim Stevens <timisg...@gmail.com> wrote:

> Sure Ketan I cannot get the tool to connect to my H2 database.  I am
> getting this error message when I try to run the tool:
>
> ERROR [main] DbSync:103 - null
> java.sql.SQLException: Cannot load JDBC driver class ''org.h2.Driver''
>         at
> org.apache.commons.dbcp2.DriverFactory.createDriver(DriverFactory.java:54)
>         at
> org.apache.commons.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:472)
>         at
> org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:538)
>         at
> org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:753)
>         at com.thoughtworks.go.dbsync.Util.withDataSource(Util.java:95)
>         at com.thoughtworks.go.dbsync.DbSync.export(DbSync.java:77)
>         at com.thoughtworks.go.dbsync.cli.Main.main(Main.java:46)
> Caused by: java.lang.ClassNotFoundException: 'org.h2.Driver'
>         at
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
>         at
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown
> Source)
>         at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
>         at
> org.apache.commons.dbcp2.DriverFactory.createDriver(DriverFactory.java:49)
>         ... 6 common frames omitted
> java.lang.RuntimeException: java.sql.SQLException: Cannot load JDBC driver
> class ''org.h2.Driver''
>         at com.thoughtworks.go.dbsync.Util.withDataSource(Util.java:104)
>         at com.thoughtworks.go.dbsync.DbSync.export(DbSync.java:77)
>         at com.thoughtworks.go.dbsync.cli.Main.main(Main.java:46)
> Caused by: java.sql.SQLException: Cannot load JDBC driver class
> ''org.h2.Driver''
>         at
> org.apache.commons.dbcp2.DriverFactory.createDriver(DriverFactory.java:54)
>         at
> org.apache.commons.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:472)
>         at
> org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:538)
>         at
> org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:753)
>         at com.thoughtworks.go.dbsync.Util.withDataSource(Util.java:95)
>         ... 2 more
> Caused by: java.lang.ClassNotFoundException: 'org.h2.Driver'
>         at
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
>         at
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown
> Source)
>         at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
>         at
> org.apache.commons.dbcp2.DriverFactory.createDriver(DriverFactory.java:49)
>         ... 6 more
>
> This is what I am using to run the tool from an elevated command window:
>
> gocd-database-migrator --insert --progress
> --source-db-url='jdbc:h2:/h2/cruise'
> --source-db-driver-class='org.h2.Driver' --source-db-user='go'
> --source-db-password='g0get!t'
> --target-db-url='jdbc:postgresql://localhost:5432/cruise'
> --target-db-driver-class='org.postgresql.Driver'
> --target-db-user='postgres' --target-db-password='postgres'
>
> Thanks in advance for your help!
> On Sunday, September 4, 2022 at 11:30:29 PM UTC-7 ketanpad...@gmail.com
> wrote:
>
>> Can you elaborate what issues you faced with the migrator tool?
>>
>> - Ketan
>>
>>
>>
>> On Sat, Sep 3, 2022 at 4:39 PM Tim Stevens <timi...@gmail.com> wrote:
>>
>>> Hello all, still on GoCD 20.4.0.  Has anyone successfully used the
>>> gocd-database-migrator.1.0.0 tool?  I have tried everything that I know to
>>> get it to run and I simply cannot.  I would be interested to know if anyone
>>> has been able to use the tool successfully?
>>>
>>> On Sunday, August 28, 2022 at 6:16:50 AM UTC-7 Chad Wilson wrote:
>>>
>>>> Tim had already asked about upgrades in
>>>> https://groups.google.com/g/go-cd/c/ugTXHPOXNoQ/m/tQ8ovKq8AQAJ and
>>>> https://groups.google.com/g/go-cd/c/EuIqzYsl7mU/m/kkj8b_L3AwAJ - in
>>>> May they were on 20.4.0, and I had suggested the best time to do a DB
>>>> switch is probably during the 20.4.0 -> 20.5.0 upgrade since the use of
>>>> that migrator tool is basically mandatory during that upgrade regardless of
>>>> whether the plan is to stay on H2 or not (due to breaking change in H2
>>>> database version).
>>>>
>>>> But not sure if they have subsequently upgraded while keeping to H2 or
>>>> not. I had assumed he had, but perhaps that was a mistake, so yeah - it
>>>> would be useful to know.
>>>>
>>>> -Chad
>>>>
>>>> On Sun, Aug 28, 2022 at 8:42 PM Ketan Padegaonkar <
>>>> ketanpad...@gmail.com> wrote:
>>>>
>>>>> What version of GoCD are you using?
>>>>>
>>>>> On Fri, 26 Aug, 2022, 22:55 Tim Stevens, <timi...@gmail.com> wrote:
>>>>>
>>>>>> Hello, I have researched this question quite a bit, but am not
>>>>>> finding anything that works.  I would like to take the data in our GoCD 
>>>>>> H2
>>>>>> database and upload it/convert it to a PostgreSQL database.
>>>>>>
>>>>>> Any help would be appreciated!
>>>>>>
>>>>>> Tim
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "go-cd" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to go-cd+un...@googlegroups.com.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/go-cd/ee37d34c-a591-4ce4-8e26-37fb39f4182an%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/go-cd/ee37d34c-a591-4ce4-8e26-37fb39f4182an%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "go-cd" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to go-cd+un...@googlegroups.com.
>>>>>
>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/go-cd/CAMUPJd6nZqdW_rjZ-MANh%3Dh_bRZEB7qZxxenbpfQOLDUjR%3DV1A%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/go-cd/CAMUPJd6nZqdW_rjZ-MANh%3Dh_bRZEB7qZxxenbpfQOLDUjR%3DV1A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "go-cd" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to go-cd+un...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/go-cd/ff1d45dc-b65d-4943-9426-18df58ad00ffn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/go-cd/ff1d45dc-b65d-4943-9426-18df58ad00ffn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "go-cd" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to go-cd+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/go-cd/cb9b3591-2557-4e3d-9038-64ce67f92b77n%40googlegroups.com
> <https://groups.google.com/d/msgid/go-cd/cb9b3591-2557-4e3d-9038-64ce67f92b77n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to go-cd+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/go-cd/CAA1RwH-wR-fdguFJmPYP6pH0QUOMQ5Hp8i33kdzLXTxbp%3D0zKA%40mail.gmail.com.

Reply via email to