官方的例子我都看了下 并试着做了个能把计划保存到数据库和读取 但是报了个异常: xception in thread "main" org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: 第 1 行: 只有 DECLARE CURSOR 才允许使用 FOR UPDATE 子句。 [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: 第 1 行: 只有 DECLARE CURSOR 才允许使用 FOR UPDATE 子句。] at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:112) at org.quartz.impl.jdbcjobstore.DBSemaphore.obtainLock(DBSemaphore.java:112) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3753) at org.quartz.impl.jdbcjobstore.JobStoreTX.executeInLock(JobStoreTX.java:93) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInLock(JobStoreSupport.java:3684) at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJobAndTrigger(JobStoreSupport.java:1035) at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:732) at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:265)希望那位大侠能帮忙解决!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
就是啊, 我有 quartz 的例子 和 spring 集合Quartz 的例子, 如果楼主需要的话,可以打包发给你。
已经发给你了, 有工程文件, document 和 jar 包。 工程文件里面 我几乎把所有关于 Quartz 的事例,和 spring 集合的都做了一个。 你看了就会懂了, 不难。
并试着做了个能把计划保存到数据库和读取
但是报了个异常:
xception in thread "main" org.quartz.impl.jdbcjobstore.LockException: Failure obtaining db row lock: 第 1 行: 只有 DECLARE CURSOR 才允许使用 FOR UPDATE 子句。 [See nested exception: com.microsoft.sqlserver.jdbc.SQLServerException: 第 1 行: 只有 DECLARE CURSOR 才允许使用 FOR UPDATE 子句。]
at org.quartz.impl.jdbcjobstore.StdRowLockSemaphore.executeSQL(StdRowLockSemaphore.java:112)
at org.quartz.impl.jdbcjobstore.DBSemaphore.obtainLock(DBSemaphore.java:112)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3753)
at org.quartz.impl.jdbcjobstore.JobStoreTX.executeInLock(JobStoreTX.java:93)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInLock(JobStoreSupport.java:3684)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJobAndTrigger(JobStoreSupport.java:1035)
at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:732)
at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:265)希望那位大侠能帮忙解决!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
非常感谢Ghost_520 的代码
但你的简单了点
不能满足我的需求
还有那位大侠帮帮忙吗
贴代码也行
交流学习!!!!!!!!!!
还在等待!!!!!!!!!!!!!!!!!!!!!!!!!!!
quartz也没用过
帮不上忙了
楼主可以动手试试
据说在你的配置文件中增加这个就好了。
Quartz 是通过设定时间来处理一些业务逻辑的, 你说的“不等定时时间就触发” 是个什么意思?
不知道是不是我配置文件写错了
quartz.properties
org.quartz.scheduler.instanceId = instance_one
org.quartz.scheduler.instanceName = DefaultQuartzSchedulerorg.quartz.scheduler.rmi.export = false
org.quartz.scheduler.rmi.proxy = false
org.quartz.scheduler.wrapJobExecutionInUserTransaction = false#============================================================================
# 配置ThreadPool多线层池
#============================================================================
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true#============================================================================
# 配置 JobStore连接数据库
#============================================================================org.quartz.jobStore.misfireThreshold = 60000org.quartz.jobStore.selectWithLockSQL=SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.MSSQLDelegate
org.quartz.jobStore.useProperties=false
org.quartz.jobStore.dataSource=myDS
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.jobStore.isClustered=true#============================================================================
# Other Example Delegates
#============================================================================
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.CloudscapeDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.DB2v6Delegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.DB2v7Delegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.DriverDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.MSSQLDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PointbaseDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.WebLogicDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
#org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.WebLogicOracleDelegate#============================================================================
# 配置数据源
#============================================================================org.quartz.dataSource.myDS.driver = com.microsoft.sqlserver.jdbc.SQLServerDriver
org.quartz.dataSource.myDS.URL = jdbc:sqlserver://localhost:1433;databaseName=Y2T114OA
org.quartz.dataSource.myDS.user =sa
org.quartz.dataSource.myDS.password =123456
org.quartz.dataSource.myDS.maxConnections = 20还有就是我没写任何xml文件最近老师催项目
急急急急