Hi there!

 

Banging my head here. So what am I doing wrong???

Error: org.h2.jdbc.JdbcSQLException: Wrong user name or password (but only
in auto_server mode, when connecting using TCP url)

 

 

Starting database in embedded mode from my application (at a server process,
at Linux Redhat 7):

My app starts using the following URL:

jdbc:h2:file:/asetune/data/SYB_SEK_MXGT25_2017-06-29;DATABASE_TO_UPPER=false
;MAX_COMPACT_TIME=2000;COMPRESS=TRUE;AUTO_SERVER=TRUE;WRITE_DELAY=5000

 

 

Lock file looks like: (where I can pick up the port number)

more /asetune/data/SYB_SEK_MXGT25_2017-06-29.lock.db

#FileLock

#Thu Jun 29 15:37:45 CEST 2017

hostName=sek-asetune.sek.se

id=15cf41266f6db8fd631ad1919b0cc4bbe7917a833ed

method=file

server=10.46.31.181\:45280

 

 

Now I want to connect to the database from another tool (possibly at another
computer, or a PC running windows)

But for simplicity I use "org.h2.tools.Shell" on the same machine to test
connectivity.

 

OK: And it works with FILE URL: 

[sybase@sek-asetune lib]$ java -cp h2-1.4.194.jar org.h2.tools.Shell  -url
'jdbc:h2:file:/asetune/data/SYB_SEK_MXGT25_2017-06-29;DATABASE_TO_UPPER=fals
e;AUTO_SERVER=TRUE' -user sa -password ''

 

Welcome to H2 Shell 1.4.194 (2017-03-10)

Exit with Ctrl+C

Commands are case insensitive; SQL statements end with ';'

help or ?      Display this help

list           Toggle result list / stack trace mode

maxwidth       Set maximum column width (default is 100)

autocommit     Enable or disable autocommit

history        Show the last 20 statements

quit or exit   Close the connection and exit

 

sql> select * from INFORMATION_SCHEMA.CATALOGS;

CATALOG_NAME

SYB_SEK_MXGT25_2017-06-29

(1 row, 13 ms)

sql> exit

Connection closed

[sybase@sek-asetune lib]$

 

FAIL: But if FAILS with TCP URL: 

[sybase@sek-asetune lib]$ java -cp h2-1.4.194.jar org.h2.tools.Shell  -url
'jdbc:h2:tcp://sek-asetune.sek.se:45280/asetune/data/SYB_SEK_MXGT25_2017-06-
29;DATABASE_TO_UPPER=false;AUTO_SERVER=TRUE' -user sa -password ''

Exception in thread "main" org.h2.jdbc.JdbcSQLException: Wrong user name or
password [28000-194]

        at
org.h2.message.DbException.getJdbcSQLException(DbException.java:345)

        at org.h2.message.DbException.get(DbException.java:179)

        at org.h2.message.DbException.get(DbException.java:155)

        at org.h2.message.DbException.get(DbException.java:144)

        at
org.h2.server.TcpServer.checkKeyAndGetDatabaseName(TcpServer.java:509)

        at org.h2.server.TcpServerThread.run(TcpServerThread.java:123)

        at java.lang.Thread.run(Thread.java:745)

 

        at org.h2.engine.SessionRemote.done(SessionRemote.java:629)

        at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:134)

        at org.h2.engine.SessionRemote.connectServer(SessionRemote.java:453)

        at
org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:334)

        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:116)

        at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:100)

        at org.h2.Driver.connect(Driver.java:69)

        at java.sql.DriverManager.getConnection(DriverManager.java:664)

        at java.sql.DriverManager.getConnection(DriverManager.java:247)

        at org.h2.tools.Shell.runTool(Shell.java:148)

        at org.h2.tools.Shell.main(Shell.java:81)

[sybase@sek-asetune lib]$

 

Obviously the port are up and running. If it would have been the wrong port
I would have got error message similar to:

org.h2.jdbc.JdbcSQLException: Connection is broken:
"java.net.ConnectException: Connection refused (Connection refused):
sek-asetune.sek.se:45289" [90067-194]

 

 

What the heck am I doing wrong???

I was assuming that AUTO_SERVER=TRUE started up a port that "another
process" could connect to, using the same user/password.

 

Thanks for your help

/Goran Schwarz

 

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to