Hello Kyrre, you're right : the current behaviour is bugged. If you want to use the resultSet, the connection need to stay open. This connector has been released a long time ago and has probably been updated without tests. As Jerome said, we are working on some refactorings to the JDBC Client in order to return XML result sets. That is to say, the jdbcHelper will get the resultSet, generate an XML Representation of the resultSet then release the connection, and return the new representation. The main reason of this refactoring is that keeping an open connection does not really comply with a REST approach.
This refactoring will be done in a few days. So, you can wait for this or ask for a patch of the current behaviour. Feel free to tell us your needs. Best regards, Thierry Boileau On 11/23/06, Kyrre Kristiansen <[EMAIL PROTECTED]> wrote:
Hello, again. I think I might have found the problem. I might have misread the code completely, but here's what I think is the case. In JDBCHelper.handle(), the connection is closed in a finally-block, before we get a chance to get a hold of the ResultSet, and hence we get the exception I mentioned in my previous mail. Closing the connection for each request seems a bit strange to me, since it never checks to see if the connection is pooled. As far as I can see, this will give you a pool of closed connections, not what we want. I think the finally-block should be removed completely from the handle code, and replaced by some way of telling the client(helper) that we're done with the connection, and it can be returned to the pool or closed. If you want, I can create a bug report on this. Regards, Kyrre --- Jerome Louvel <[EMAIL PROTECTED]> wrote: > > Hi Kyrre, > > You shouldn't directly use the JdbcClientHelper > class. You should instead > create a new org.restlet.Client for the protocol > Protocol.JDBC. > > As for the error message, I'm not sure why you are > getting this. Please try > to update to beta 20 and create a new bug report if > this still doesn't work. > > BTW, we are working on some refactorings to the JDBC > Client in order to > return XML result sets (via WebRowSet): > http://restlet.tigris.org/issues/show_bug.cgi?id=104 > It should be done in > the beta 21 release. > > Best regards, > Jerome > > > -----Message d'origine----- > > De : Kyrre Kristiansen > [mailto:[EMAIL PROTECTED] > > Envoyé : lundi 20 novembre 2006 15:46 > > À : [email protected] > > Objet : JDBCClient > > > > Hello, all. > > > > I'm trying to use the JDBCClient to connect to a > > database in one of my handlers. I use the > > JDBCClientHelper to do this, but when I try to get > the > > ResultSet from the response, I get an SQL > exception: > > "java.sql.SQLException: > > org.apache.commons.dbcp.DelegatingStatement is > > closed." > > > > Note that I'm still on beta19, I've not had the > time > > to upgrade yet, but as far as I can see, nothing > has > > been done to the jdbclient stuff since beta19. > > > > Here's a snippet of code I'm using: > > <snip> > > > > String query = "SELECT id, url from > feeddescriptions > > where id = " + id + ""; > > Request request = > > > JdbcClientHelper.create(connectionString,generateRepresentatio > > n(query)); > > Response respone = new Response(request); > > helper.handle(request,respone); > > ObjectRepresentation output = > > (ObjectRepresentation)respone.getEntity(); > > > > try { > > //JdbcResult jdbcResult = getJdbcResult(query); > > JdbcResult jdbcResult = > > (JdbcResult)output.getObject(); > > ResultSet result = jdbcResult.getResultSet(); > > if (result.next()) { > > int dbid = result.getInt("id"); > > String url = result.getString("url"); > > feed = new FeedDescription(dbid,url); > > } > > } catch (IOException e) { > > e.printStackTrace(); > > } catch (SQLException e) { > > e.printStackTrace(); > > } > > > > </snip> > > > > Can anyone see anything wrong here, or is this a > bug? > > Maybe I have to upgrade to get the bug fix? > > > > Regards, > > Kyrre. > > > > > > > > > ------------------------------------------------------------ > > Kyrre Kristiansen > > > > > > > > > > > > > ___________________________________________________________ > > > All new Yahoo! Mail "The new Interface is stunning > in its > > simplicity and ease of use." - PC Magazine > > http://uk.docs.yahoo.com/nowyoucan.html > ------------------------------------------------------------ Kyrre Kristiansen ___________________________________________________________ All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine http://uk.docs.yahoo.com/nowyoucan.html

