Hi all, after 2.5 years of production my application starts to have some problem. Here is the error that I am experiencing
--- The error occurred while applying a parameter map. --- Check the Foo.bar-InlineParameterMap. --- Check the statement (query failed). --- Cause: java.sql.SQLException: Closed Connection My application is performing some crud operation. In order to speed-up I decided to use an Hashtable to store SqlMapClient. The previous error appears if the number of running threads increases. Otherwise I don't have any problem if I do not use any cache for SqlMapClient. Any suggestion? Thanks to all in advance Giuseppe De Gaetano -----Messaggio originale----- Da: De Gaetano Giuseppe [mailto:degaet...@pitagora.it] Inviato: venerdì 5 gennaio 2007 16.39 A: user-java@ibatis.apache.org; lmead...@apache.org Oggetto: R: SqlMapClient multithread applications Hi, may be I wasn't clear enough. With concurrency I meant2 threads each doing the following operations: 1. Start transaction. 2. insert row 3. insert another row 4. commit/rollback transaction In this situation is the transaction isolation guaranteed? > Is there any best practice? == speed up application end avoid loading every > time the same config files -----Messaggio originale----- Da: larry.mead...@gmail.com [mailto:larry.mead...@gmail.com] Per conto di Larry Meadors Inviato: venerdì 5 gennaio 2007 16.19 A: user-java@ibatis.apache.org Oggetto: Re: SqlMapClient multithread applications On 1/5/07, De Gaetano Giuseppe <degaet...@pitagora.it> wrote: > If the application is multithread and each thread uses the same client will > I have some problem? Should be fine. > > Is the iBatis engine handling the concurrency or should I care? What type of concurrency? If two threads update the same row in the database, the last one in wins. iBATIS does not and will not likely ever deal with that sort of thing. > Is there any best practice? Sorry if i am being dense, but for what? Larry ________________________________________ Da: De Gaetano Giuseppe [mailto:degaet...@pitagora.it] Inviato: venerdì 5 gennaio 2007 14.23 A: user-java@ibatis.apache.org Oggetto: SqlMapClient multithread applications Hi, I am coding a java multithread application. In my application I have the following object which needs to load the configuration files from a path not specified in the classpath end build an SqlMapClient. The Hashtable is used for: * cache the clients and avoid the building of a new SqlMapClient every time; * speed up the application avoiding to load and parse the different config files every time public class SqlMapClientConfig { private static Hashtable clients; static{ clients = new Hashtable(); } private SqlMapClientConfig(){ } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public static SqlMapClient getClient(String db, String usecase,) { String key = db + "." + usecase; String path = "/dat/" + db + "/" + usecase; if(clients.containsKey(key)) return (SqlMapClient) clients.get(key); else{ Loader loader = new Loader(path); Resources.setDefaultClassLoader(loader); Reader reader = null; try { reader = Resources.getResourceAsReader (loader, "sql-map-config.xml"); } catch (IOException e) { e.printStackTrace(); } SqlMapClient sqlMap = null; sqlMap = (SqlMapClient) SqlMapClientBuilder.buildSqlMapClient(reader); clients.put(key,sqlMap); return sqlMap; } } } If the application is multithread and each thread uses the same client will I have some problem? Is the iBatis engine handling the concurrency or should I care? Is there any best practice? --------------------------------------------------------------------- To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org For additional commands, e-mail: user-java-h...@ibatis.apache.org