部落客廣告聯播

2008年3月15日 星期六

Quartz使用JDBCDatasoruceTX使用tomcat datasource設置檔範例

Quartz使用JDBCDatasoruceTX使用tomcat datasource設置檔範例
[quartz.properties]


# Default Properties file for use by StdSchedulerFactory
# to create a Quartz Scheduler Instance, if a different
# properties file is not explicitly specified.
#

org.quartz.scheduler.instanceName = DefaultQuartzScheduler
org.quartz.scheduler.rmi.export = false
org.quartz.scheduler.rmi.proxy = false
org.quartz.scheduler.wrapJobExecutionInUserTransaction = false

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true

org.quartz.jobStore.misfireThreshold = 60000

# org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.CloudscapeDelegate
org.quartz.jobstore.dataSource = MailerJ
org.quartz.jobStore.useProperties = true
org.quartz.dataSource.MailerJ.jndiURL = java:comp/env/jdbc/JMailer
org.quartz.jobStore.dataSource = MailerJ

2008年3月10日 星期一

CachedRowSet .. 'populate before calling' 錯誤訊息

故事是這樣的....


使用
CachedRowSet crs=new CachedRowSetImpl();
crs.setPageSize(2);
crs.populate(resultSetObj);
while(crs.nextPage())
{
while(crs.next())
{ //... do something here }
}
竟然出現"'populate before calling' "錯誤訊息,貓的咧,一時間還撒某帳...

原來...
若是使用populate來塞資料給RowSet是無法使用分頁功能的,
原因在於換到下頁時,RowSet無法像是用setCommand去再做一次查詢....

所以說,最好的解決方法就是改用
crs.executeQuery(conn); //conn是自己先前先取得的Connection物件