Most likely, the problem is the database URL you use.
jdbc:h2:file:target/db/testdb
This means the database file is stored relative to the current working directory. So it depends where you started the application. If you started DBVisualizer in a different directory (which most likely you did), then it's creating a new database in a different directory.
To ensure you are using the same database, I suggest to use an absolute directory name, or relative to the current user home directory, as described in the H2 documentation:
jdbc:h2:~/relative/to/user/home/dir/testdb
jdbc:h2:/absolute/path/testdb
The prefix file:
is optional.