发新话题
打印

更新jor后sql报错

更新jor后sql报错

sql中使用表别名 原来正常

更新后不能在数据集后显示sql选择的列名
控制台
jatools.dataset.DatasetException: sql 出错.ORA-00933: SQL command not properly e
nded
java.sql.SQLException: ORA-00933: SQL command not properly ended
不使用别名正常

TOP

请将sqlreader.java中:
复制内容到剪贴板
代码:
               if (!withdata) {
//                    // 修正bug,当输入的sql以分号结束时
//                    while ((sqlcopy = sqlcopy.trim()).endsWith(";")) {
//                        sqlcopy = sqlcopy.substring(0, sqlcopy.length() - 1);
//                    }
//
//                    sqlcopy = "select * from (" + sqlcopy + ") a where 1=0";
                    
                    sqlcopy = SqlUtil.toNodataSql(sqlcopy);
                }
改为
复制内容到剪贴板
代码:

          if (!withdata) {
//                    // 修正bug,当输入的sql以分号结束时
                    while ((sqlcopy = sqlcopy.trim()).endsWith(";")) {
                        sqlcopy = sqlcopy.substring(0, sqlcopy.length() - 1);
                    }

                    sqlcopy = "select * from (" + sqlcopy + ") a where 1=0";
                    
//                    sqlcopy = SqlUtil.toNodataSql(sqlcopy);
                }

TOP

最新版连接oracle时 同样存在

TOP

那再改回来吧,任选一种方法:
1. svn google code
2. 用附件替换源码中的同名文件。
附件: 您所在的用户组无法下载或查看附件

TOP

改了还是有错才问的

TOP

不会吧,报啥错呢,发上来

TOP

sql 出错.ORA-00933: SQL command not properly ended


java.sql.SQLException: ORA-00933: SQL command not properly ended

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java
:112)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
        at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
        at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.
java:216)
        at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPrepare
dStatement.java:810)
        at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStateme
nt.java:1039)
        at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPrepa
redStatement.java:850)
        at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1134)
        at oracle.jdbc.driver.OracleStatement.doScrollExecuteCommon(OracleStatem
ent.java:4055)
        at oracle.jdbc.driver.OraclePreparedStatement.doScrollPstmtExecuteUpdate
(OraclePreparedStatement.java:10826)
        at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePrep
aredStatement.java:3337)
        at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePrepare
dStatement.java:3384)
        at jatools.data.reader.sql.SqlReader.readStart(SqlReader.java:234)
        at jatools.data.reader.sql.SqlReader.getEmptyDataset(SqlReader.java:527)

        at jatools.data.reader.sql.SqlReader.doRead(SqlReader.java:479)
        at jatools.data.reader.AbstractDatasetReader.read(AbstractDatasetReader.
java:88)
        at jatools.dataset.Dataset.getFieldNames(Dataset.java:973)
        at jatools.designer.variable.DatasetTreeNodeValue.getColumns(DatasetTree
NodeValue.java:44)
        at jatools.designer.variable.NodeSourceTree.getColumns(NodeSourceTree.ja
va:765)
        at jatools.designer.variable.NodeSourceTreeRenderer.getTreeCellRendererC
omponent(NodeSourceTreeRenderer.java:174)
        at javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimen
sions(Unknown Source)
        at javax.swing.tree.AbstractLayoutCache.getNodeDimensions(Unknown Source
)
        at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePrefer
redSize(Unknown Source)
        at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(Unkno
wn Source)
        at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(Unkno
wn Source)
        at javax.swing.tree.VariableHeightLayoutCache.rebuild(Unknown Source)
        at javax.swing.tree.VariableHeightLayoutCache.treeStructureChanged(Unkno
wn Source)
        at javax.swing.plaf.basic.BasicTreeUI$Handler.treeStructureChanged(Unkno
wn Source)
        at javax.swing.tree.DefaultTreeModel.fireTreeStructureChanged(Unknown So
urce)
        at javax.swing.tree.DefaultTreeModel.reload(Unknown Source)
        at jatools.designer.variable.NodeSourceTree.updateTreeAfterNodeAdded2(No
deSourceTree.java:165)
        at jatools.designer.variable.action.DataSourceAction.updateTree(DataSour
ceAction.java:260)
        at jatools.designer.variable.action.DataSourceAction.add(DataSourceActio
n.java:200)
        at jatools.designer.variable.action.DataSourceAction.actionPerformed(Dat
aSourceAction.java:90)
        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)

jatools.dataset.DatasetException: sql 出错.ORA-00933: SQL command not properly e
nded

TOP

经过测试,不存在你说的问题,

以下两种
sqlcopy = "select * from (" + sqlcopy + ") a where 1=0";
或                  
sqlcopy = SqlUtil.toNodataSql(sqlcopy);
都可以,我们推荐使用后一种,官网下载版本和svn都是这种。所以检查一下,你的sql是否有错误,先从最简单sql的测试开始.

TOP

用 oracle 数据库确实有问题,
select * from table_a a where a.name='test'
提示错误

java.sql.SQLException: ORA-00933: SQL command not properly ended
应该是jsqlparser解析的问题,解析成 select * from table_a AS  a 这样就挂了

TOP

发新话题