0 Replies Latest reply on Feb 27, 2006 3:51 AM by lemolina

    Connection is broken

    lemolina

      Hi.
      I'm a JBoss/J2EE/EJB newby.
      I'm implementing a project manager as a homework with struts using sessions ejb and something satrange is happening: I'm using an small hypersonic database, and, when I was not using EJBs (just struts), it worked fine, but now, when I try to perform a select action on the database it throws a SQLExcetion ("Connection is broken"). I'm sure the connection is fine, because of debugging, in fact, the exception is only throwed in select action, (inserts and updates worrks fine)... here's some code:

      This works fine:

      Statement s = cnn.createStatement();

      String sql = " INSERT INTO USR_USER VALUES ('1','1')"

      s.execute(sql);





      This does not:

      Statement s = cnn.createStatement();

      String sql = " SELECT USR_ID, USR_PASSWORD " +
      " FROM USR_USER " +
      " WHERE USR_ID = '"+ id + "' AND"+
      " USR_PASSWORD = '" +password + "'";

      ResultSet result = s.executeQuery(sql); // <-- this is where the Exception is thrown



      Thanks in advance,

      LM