Connecting to auto-server/mixed mode using TCP URL?

1,001 views
Skip to first unread message

Colin McCormack

unread,
Apr 19, 2012, 5:37:56 AM4/19/12
to h2-da...@googlegroups.com
I figure what i'm trying to do isn't supported but i'll proceed with my question anyway:

I create and start my DB in auto mixed mode:
jdbc:h2:/home/me/TestDB;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9091

Then i want to connect to the server which is running (have tested this, can see the thread alive in my debugger etc)
jdbc:h2:tcp://myDBServer:9091/home/me/TestDB;IFEXISTS=TRUE

But when i try a connect with this URL - i get this error: Wrong user name or password [28000-166]

The username and password i supply are correct though - i also tried:
jdbc:h2:tcp://myDBServer:9091/home/me/TestDB;IFEXISTS=TRUE;USER=xyz;PASSWORD=xyz
But to no avail.

I figure at the very least if this URL connect isn't supported to an autoserver DB - the error should reflect this - or i'm specifying something wrong?

This page doesn't cater for what i want with mixed mode but maybe the error should be like 'tcp connect to embedded db not supported'?:
http://www.h2database.com/html/features.html#database_url

Thomas Mueller

unread,
Apr 23, 2012, 1:03:24 PM4/23/12
to h2-da...@googlegroups.com
Hi,

I figure what i'm trying to do isn't supported but i'll proceed with my question anyway:

You are right this is not supported.

I create and start my DB in auto mixed mode:
jdbc:h2:/home/me/TestDB;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9091

Then i want to connect to the server which is running (have tested this, can see the thread alive in my debugger etc)
jdbc:h2:tcp://myDBServer:9091/home/me/TestDB;IFEXISTS=TRUE

You should use the same URL as above instead: jdbc:h2:/home/me/TestDB;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9091

This is documented.

Regards,
Thomas
Reply all
Reply to author
Forward
0 new messages