Hi,

The exception says the database is already open in another process. To find
out which process that could be, I suggest to run "jps" on the command line.

Please note you are using a very old version of H2 (from 2009 I think). You
should upgrade to a more recent version.

Regards,
Thomas


On Thu, May 23, 2013 at 7:17 PM, Rnj <[email protected]> wrote:

> I have my H2 database and Jetty Web server installed in lib folder of my
> Java project. I'm trying to create a jdbc connection using following code :
>
> ServerConnector.java
>
> Server server = new Server(8080);
>>         JDBCSessionIdManager idMgr = new JDBCSessionIdManager(server);
>>         idMgr.setWorkerName("xyz");
>>         idMgr.setDriverInfo("org.h2.Driver", "jdbc:h2:~/test");
>>         idMgr.setScavengeInterval(60);
>>         server.setSessionIdManager(idMgr);
>>         server.setHandler(new HelloHandler());
>>         server.start();
>>         server.join();
>
>
> HelloHandler.java
>
>> @Override
>> public void handle(String target, Request baseRequest, HttpServletRequest
>> request, HttpServletResponse response) throws IOException, ServletException
>> {
>> response.setContentType("text/html;charset=utf-8");
>> response.setStatus(HttpServletResponse.SC_OK);
>> baseRequest.setHandled(true);
>> StringBuilder crTblQuery = new StringBuilder();
>> crTblQuery.append("SELECT AVG(Convert(BPS_AVG,INT)) FROM FRAMES where
>>  CLKRX_DATE = '2/13/2013'");
>> DbConnector dbConnector = new DbConnector();
>> try
>> {
>> Connection con = dbConnector.getDbConnection();
>> Statement st = con.createStatement();
>> ResultSet rs = st.executeQuery(crTblQuery.toString());
>> rs.next();
>> response.getWriter().println("<h1>" + rs.getString(1) + "</h1>");
>> if (_body != null)
>> response.getWriter().println(_body);
>>
>> con.close();
>> }
>> catch (ClassNotFoundException | SQLException e)
>> {
>> e.printStackTrace();
>> }
>>
>> }
>
>
> and I get following error when I run ServerConnector class
> "Database may be already in use: "Locked by another process". Possible
> solutions: close all other connection(s); use the server mode [90020-128]"
>
> How to resolve this issue?
>
>
>  --
> 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?hl=en.
> 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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to