怎么设置啊?注意我没有应用服务器(如weblogic)的支持啊,只是单纯的java class,所以没有办法使用JTA的啊!

解决方案 »

  1.   

    试一下Statement.setTimeout(int s);/**
         * Sets the number of seconds the driver will wait for a 
         * <code>Statement</code> object to execute to the given number of seconds.
         * If the limit is exceeded, an <code>SQLException</code> is thrown.
         *
         * @param seconds the new query timeout limit in seconds; zero means 
         *        there is no limit
         * @exception SQLException if a database access error occurs
         *            or the condition seconds >= 0 is not satisfied
         * @see #getQueryTimeout
         */
        void setQueryTimeout(int seconds) throws SQLException;
      

  2.   

    数据库连接也是socket连接 socket连接肯定有超时的机制的吧 
    Statement 等也应当有