This works fine for me:
String args[] = {"-tcpAllowOthers", "true", "-tcpPort", "9092", "-baseDir",
"D:/directory of the db"};
Server server = Server.createTcpServer(args);
JdbcDataSource ds = new JdbcDataSource();
ds.setURL("jdbc:h2:tcp://server_name:9092/db_name;LOCK_TIMEOUT=30000;LOCK_MODE=1;IFEXISTS=TRUE;ALIAS_COLUMN_NAME=TRUE");
ds.setUser(userName);
ds.setPassword(password);
JdbcConnectionPool pool = JdbcConnectionPool.create(dataSource);
pool.setLoginTimeout(loginTimeout);
pool.setMaxConnections(maxConnections);
Connection con = pool.getConnection();
On Tue, Feb 15, 2011 at 10:44 AM, Jogi <[email protected]> wrote:
> Thanks for the answer,
>
> but it still doesn't work.
>
> I'm starting the App the with:
>
> String tcpArgs = "-baseDir E:\data -tcpAllowOthers -tcpDaemon";
> tcpServer = Server.createTcpServer(tcpArgs);
>
> so far so good, then trying to connect via Tcp from Tomcat:
>
> jdbc:h2:tcp://localhost/mydbname;IFEXISTS=TRUE
>
> it ends up with:
> Database "C:\Users\XXX\mydbname" not found [90013-148]
>
> on tomcat side i can't provid a baseDir.
>
> Am I missing something?
>
> Cheers
>
>
>
>
>
>
> > It is enough to connect via tcp and port, you just have to specify
> > where the database is by using "-baseDir".
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> 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.
>
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
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.