Your example worked for me with one small change - using 'admin' as 
password with 'sa'


On Sunday, May 17, 2009 3:28:06 PM UTC-5, Darek wrote:
>
> Greetings, 
> I would like to try to use H2 db with php using pdo. I was able to 
> find that this should work, unfortunately it doesn't work for me. 
> After googling for many hours I couldn't find any solution, not a 
> single example. And I'm stuck. Maybe someone coud help me. 
>
> Here is what I was able to do so far: 
> I have h2 up and running on a Linux machine. I'm starting it with this 
> command: 
> java -cp h2*.jar org.h2.tools.Server -web -webAllowOthers -tcp - 
> tcpAllowOthers -pg -pgAllowOthers -baseDir /usr/share/h2/databases 
> After that servers are running on default ports (web - 8082, tcp - 
> 9092, pg - 5435). 
> I am able to connect with a web browser to the console, i am able to 
> login to the test database using the "sa" user. SQL commands under 
> console work as expected. 
>
> Now some things that do not work: 
> I am unable to connect with a psql client. I'm not sure if this is 
> supposed to work. Anyway when I do: 
> psql -h 127.0.0.1 -p 5435 test sa 
> it asks for password and after typing it (I tried both when the sa 
> account has no password and after setting a password) it throws a 
> message: 
> org.h2.jdbc.jdbcSQLException: Wrong user name or password [8004-112]. 
> I am not sure, why is jdbc handling this. 
>
> Connecting with php also doesn't work for me. I read that postgres 
> driver requires a password, so the sa account had the password set. 
> I am trying to use the following code: 
>
> <?php 
> $config['dbuser'] = 'sa'; 
> $config['dbpass'] = 'sa123'; 
> $config['dsn'] = 'pgsql:host=127.0.0.1 dbname=test port=5435'; 
>
> try { 
>     $db = new PDO($config['dsn'], $config['dbuser'], $config 
> ['dbpass']); 
>     } 
>
> catch(PDOException $e) { 
>     echo 'DB error: '. $e->getMessage(); 
> } 
> ?> 
>
> And it fails: 
> DB error: SQLSTATE[08006] [7] server closed the connection 
> unexpectedly This probably means the server terminated abnormally 
> before or while processing the request. 
>
> Server outputs the same error as earlier: 
> org.h2.jdbc.jdbcSQLException: Wrong user name or password [8004-112]. 
>
> Sorry for such a long post, but I tried to supply as many information 
> I could. 
> I'm stuck now with this problem. Please help :) 
>
> Best regards, 
> Darek 
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/DzY3qVr85EoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to