Hi all.

Lucy thanks for your answer :+)
http://lucy.ysalaya.org

My issue is not closed because the site crashes these days.

I do not think I use the same connection in different threads at the same
time.

I am still using the javasqlite ODBC driver.
But I did not but the jdbc into the Tomcat server.xml file.
As I did for MySQL because as far as know, the jdbc needs the path to the
database file
and under my project, all the chatbot databases are different
/user_idr/bot_base_type.db

Here is my source code for the Java class connection.
Maybe you can have a look (it is simple, maybe too much)

_________________________________________________________________________
Copyright 2006-2007 Frederic de la Goublaye
_________________________________________________________________________
public class SQLite {
   private static Logger logger = Logger.getLogger(SQLite.class.getName());
   private final static String pilote = " SQLite.JDBCDriver";
   private Connection con = null;
   private PreparedStatement s;
   private  static SQLite instance = new SQLite();
   public static SQLite getInstance() {return instance;}
   private static String sDBPath;
private SQLite() {
   try {
       Class.forName(pilote);
       con = null;
       s = null;
   } catch (Exception e) {
       logger.error(e.getMessage());
   }
}
public String getDBPath() {return sDBPath;}
public void setDBPath(String pDBPath) {sDBPath= pDBPath;}
public void connection(String pDBPath) {
   try {
        sDBPath = pDBPath;
        con = DriverManager.getConnection(sDBPath);
        con.setAutoCommit ( true );
   }
   catch (SQLException e) {
       logger.error(e.getMessage());
       logger.error("sDBPath="+sDBPath);
       if (con != null) {
           try {
               con.close();
           } catch (Exception ex) {
               logger.error(ex.getMessage());
           }
           finally {
               con = null;
           }
       }
   }
}
public void deconnection() {
   if (s != null) {
       try {
           s.close();
       } catch (Exception e) {
           logger.error(e.getMessage());
       }
       finally {
           s = null;
       }
   }
   if (con != null) {
       try {
           con.close();
       } catch (Exception e) {
           logger.error(e.getMessage());
       }
       finally {
           con = null;
       }
   }
}
public ResultSet execQuery(String pRequest) {
   try
   {
       s = con.prepareStatement(pRequest);
       ResultSet rset = s.executeQuery();
       return rset;
   }
  catch(SQLException e) {
      logger.error(e.getMessage());
      logger.error("sSql="+pRequest);
      if (s != null) {
          try {
              s.close();
          } catch (Exception ex) {
              logger.error(ex.getMessage());
          }
          finally {
              s = null;
          }
      }
      return null;
   }
}
public void finalize() {
   try {
     deconnection();
   }
   catch (Exception e) {
       logger.error(e.getMessage());
   }
}
public String getStringForSQL(String str) {
   StringBuffer sb = new StringBuffer(255);
   if (str == null) return str;
   char[] cc = str.toCharArray();
   for (char i = 0; i < cc.length; i++) {
       if (cc[i] == '\'') {
           sb.append('\\');
       } else if (cc[i] == '\\') {
           sb.append('\\');
       }
       sb.append(cc[i]);
   }
   return sb.toString();
}
}
_____________________________________________________________

Thanks again for your attention.

Frederic de la Goublaye


On 6/3/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


> My project is working with Tomcat, SQLite and javasqlite.
> http://www.ch-werner.de/javasqlite/
>
> http://www.ysalaya.org
>
> Since a few weeks Tomcat server crashes very often: error 505
> and I need to restart it manually. It is installed on FreeBSD 5.4.
>
> Please see the Tomcat log file bellow.
> It seems to be an error in SQLite outsite the Java Virtual Machine.
>
> ANY IDEAR ?

I see 2 possible explanations:
1. You use the same connection in different threads at the same time.
2. There are bugs in JDBC driver. If this is the case, try driver from
http://www.zentus.com/sqlitejdbc. It for sure has bugs, but may be
different and you won't even notice them. You may use pure java version -
it will be probably slower than JNI based, but should never crash VM.



----------------------------------------------------------------------
Wicie, rozumicie....
Zobacz >>> http://link.interia.pl/f1a74



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]

-----------------------------------------------------------------------------


Reply via email to