I'm sorry to confuse you. I could resolve the issue. 
I am trying to get a jdbc connection through jetty in serverconnector class 
and in hellohandler class I am again trying to the connection using 
DriverManager, that created exception.
I'm curious to know, how did you get the version of H2 database I'm using?

On Thursday, May 23, 2013 1:32:13 PM UTC-5, Thomas Mueller wrote:
>
> 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] 
> <javascript:>>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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> 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