注册
登录
标签
统计
帮助
杰表技术论坛
»
简表(JOR)
» 关于在jdbc数据集中使用参数的问题?
‹‹ 上一主题
|
下一主题 ››
发新话题
发布投票
发布商品
发布悬赏
发布活动
发布辩论
发布视频
打印
关于在jdbc数据集中使用参数的问题?
gengv
新手上路
发短消息
加为好友
当前离线
1
#
大
中
小
发表于 2010-1-18 21:40
显示全部帖子
关于在jdbc数据集中使用参数的问题?
JOR设计的确实很不错,我用它做了行列并行层级不等的交叉表,很好使。
不过,我想在JDBC数据集中使用参数来作为where的条件。我照着使用手册,在select语句中使用了${参数名},但是提示MySQL语法错误,看来在将语句传递给MySQL之前,似乎并没有解析脚本内容啊?
错误信息:
sql error.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2978)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:933)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1027)
at jatools.data.reader.sql.SqlReader.readStart(SqlReader.java:200)
at jatools.designer.data.DatasetTable.setDataSet(DatasetTable.java:82)
at jatools.designer.data.DatasetPreviewer$1.windowOpened(DatasetPreviewer.java:82)
at java.awt.AWTEventMulticaster.windowOpened(Unknown Source)
at java.awt.Window.processWindowEvent(Unknown Source)
at javax.swing.JDialog.processWindowEvent(Unknown Source)
at java.awt.Window.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.Dialog$1.run(Unknown Source)
at java.awt.Dialog$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Unknown Source)
at jatools.designer.data.DatasetPreviewer.show(DatasetPreviewer.java:201)
at jatools.designer.SqlReaderDialog.preview(SqlReaderDialog.java:92)
at jatools.designer.SqlReaderDialog.access$0(SqlReaderDialog.java:87)
at jatools.designer.SqlReaderDialog$1.actionPerformed(SqlReaderDialog.java:143)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.Dialog$1.run(Unknown Source)
at java.awt.Dialog$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Unknown Source)
at jatools.designer.data.jdbc.SqlReaderFactory.edit(SqlReaderFactory.java:60)
at jatools.designer.variable.action.DataSourceAction.modifyAction(DataSourceAction.java:163)
at jatools.designer.variable.action.DataSourceAction.actionPerformed(DataSourceAction.java:81)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
还请各位指点迷津。谢谢!
UID
340
帖子
6
精华
0
积分
0
阅读权限
10
在线时间
6 小时
注册时间
2010-1-18
最后登录
2010-2-3
查看详细资料
TOP
gengv
新手上路
发短消息
加为好友
当前离线
2
#
大
中
小
发表于 2010-1-22 19:32
显示全部帖子
不好意思,今天白天论坛无法发贴回复,不得已才给管理员发的站内消息。
UID
340
帖子
6
精华
0
积分
0
阅读权限
10
在线时间
6 小时
注册时间
2010-1-18
最后登录
2010-2-3
查看详细资料
TOP
gengv
新手上路
发短消息
加为好友
当前离线
3
#
大
中
小
发表于 2010-1-22 19:51
显示全部帖子
谢谢管理员的耐心解答,我试着对String类型的参数也尝试一下:
SELECT sales.dq,sales.dw,sales.name,sales.year,sales.quarter,sales.month,sales.month_num FROM sales where Quarter=
'${ has(paramQuarter) ? paramQuarter: "第一季度" }'
顺利得到结果。
如果还有什么疑问回头再像管理员请教。
UID
340
帖子
6
精华
0
积分
0
阅读权限
10
在线时间
6 小时
注册时间
2010-1-18
最后登录
2010-2-3
查看详细资料
TOP
‹‹ 上一主题
|
下一主题 ››
杰表.bi解决方案
杰表云打印(JCP),jatoolsPrinter
杰表.web条形码
java开源技术