Hi,

I believe the correct way to specify an empty user name is

java ... -user ""

(that means, without the single quotes). If you use '""' then the user name
consists of two double quotes. At least that's what I get.

Regards,
Thomas


On Wednesday, August 28, 2013, Peter wrote:

> The required -user argument is: -user '""', that is single quotes
> surrounding the empty double quotes. No -password argument is required.
>
> PS F:\> java -cp b:/h2.jar org.h2.tools.Script -url jdbc:h2:file:junk
> -user '""'  -script backup/junk.sql
>
> or
>
> PS F:\> java -cp b:/h2.jar org.h2.tools.Script -url jdbc:h2:file:junk
> -user '""'  -script backup/junk.zip -options compression zip
>
> if you want it zipped
>
> On Wednesday, August 28, 2013 10:26:08 AM UTC-7, Peter wrote:
>>
>> h2-1.3.173.jar
>> Windows 7, Powershell and Cmd
>>
>> I created a H2 database in a java pgm without a username or password. The
>> file opens fine in H2 console (or anything else) by just leaving the
>> username and password fields blank but I cannot get Script or Shell to open
>> it correctly. The issue seems to be how to correctly specify blank user
>> name and password. Are these supported in the Script and Shell command line
>> tools?
>>
>> For example, when I try to run the following cmd in a Powershell (or cmd)
>> window in the same directory as the h2 db file, I get Wrong user name or
>> password error.
>>
>> PS F:\> java -cp b:/h2.jar org.h2.tools.Script -url jdbc:h2:file:test-db
>> -script backup/test-db.2013.08.28.sql
>> Exception in thread "main" org.h2.jdbc.JdbcSQLException: Wrong user name
>> or password [28000-173]
>>         at org.h2.message.DbException.**getJdbcSQLException(**
>> DbException.java:331)
>>         at org.h2.message.DbException.**get(DbException.java:171)
>>         at org.h2.message.DbException.**get(DbException.java:148)
>>         at org.h2.message.DbException.**get(DbException.java:137)
>>         at org.h2.engine.Engine.**validateUserAndPassword(**
>> Engine.java:302)
>>         at org.h2.engine.Engine.**createSessionAndValidate(**
>> Engine.java:147)
>>         at org.h2.engine.Engine.**createSession(Engine.java:122)
>>         at org.h2.engine.Engine.**createSession(Engine.java:28)
>>         at org.h2.engine.SessionRemote.**connectEmbeddedOrServer(**
>> SessionRemote.java:313)
>>         at org.h2.jdbc.JdbcConnection.<**init>(JdbcConnection.java:105)
>>         at org.h2.jdbc.JdbcConnection.<**init>(JdbcConnection.java:90)
>>         at org.h2.Driver.connect(Driver.**java:73)
>>         at java.sql.DriverManager.**getConnection(DriverManager.**
>> java:579)
>>         at java.sql.DriverManager.**getConnection(DriverManager.**
>> java:221)
>>         at org.h2.tools.Script.execute(**Script.java:157)
>>         at org.h2.tools.Script.execute(**Script.java:136)
>>         at org.h2.tools.Script.runTool(**Script.java:104)
>>         at org.h2.tools.Script.main(**Script.java:53)
>>
>>
>> Using -user "" -password "" does not seem to work either:
>>
>> PS F:\> java -cp b:/h2.jar org.h2.tools.Script -url jdbc:h2:file:test-db
>> -user ""-password "" -script backup/test-db.2013.08.28.sql
>> Exception in thread "main" org.h2.jdbc.JdbcSQLException: Wrong user name
>> or password [28000-173]
>>         at org.h2.message.DbException.**getJdbcSQLException(**
>> DbException.java:331)
>>         at org.h2.message.DbException.**get(DbException.java:171)
>>         at org.h2.message.DbException.**get(DbException.java:148)
>>         at org.h2.message.DbException.**get(DbException.java:137)
>>         at org.h2.engine.Engine.**validateUserAndPassword(**
>> Engine.java:302)
>>         at org.h2.engine.Engine.**createSessionAndValidate(**
>> Engine.java:147)
>>         at org.h2.engine.Engine.**createSession(Engine.java:122)
>>         at org.h2.engine.Engine.**createSession(Engine.java:28)
>>         at org.h2.engine.SessionRemote.**connectEmbeddedOrServer(**
>> SessionRemote.java:313)
>>         at org.h2.jdbc.JdbcConnection.<**init>(JdbcConnection.java:105)
>>         at org.h2.jdbc.JdbcConnection.<**init>(JdbcConnection.java:90)
>>         at org.h2.Driver.connect(Driver.**java:73)
>>         at java.sql.DriverManager.**getConnection(DriverManager.**
>> java:579)
>>         at java.sql.DriverManager.**getConnection(DriverManager.**
>> java:221)
>>         at org.h2.tools.Script.execute(**Script.java:157)
>>         at org.h2.tools.Script.execute(**Script.java:136)
>>         at org.h2.tools.Script.runTool(**Script.java:104)
>>         at org.h2.tools.Script.main(**Script.java:53)
>>
>> The database file is definitely being found as I get a lock error if I
>> keep it open in Console and try one of the above.
>> Thanks for the help, Peter
>>
>  --
> 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] <javascript:_e({},
> 'cvml', 'h2-database%[email protected]');>.
> To post to this group, send email to 
> [email protected]<javascript:_e({}, 'cvml', 
> '[email protected]');>
> .
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to