简体   繁体   English

Java JDBC Oracle 9i升级到10g问题

[英]Java JDBC Oracle 9i upgrade to 10g issues

We have just upgrade from oracle 9i to 10g and a database query I have works with the 9i client but not the 10g. 我们刚刚从oracle 9i升级到10g,并且数据库查询与9i客户端一起工作,但与10g无关。 Nothing in the query has changed. 查询中的任何内容都没有更改。 I get the following error: 我收到以下错误:

java.sql.SQLException: ORA-01036: illegal variable name/number

Not really sure what is going on. 不太确定发生了什么。 Why wouldn't it run anymore. 为什么它不再运行了。 It's just a select statement which joins about 3 or 4 tables. 这只是一条选择语句,它联接了大约3或4个表。 I am making sure that I am passing in the variable using setInt (it's a number that I'm using). 我确保使用setInt传递变量(这是我正在使用的数字)。 While diff'ing the tables being joined the only thing I find different is that on one table a column I'm joining is set to be a Number on one table and Number(12) on the other. 在比较要联接的表时,我发现的唯一不同之处在于,在一个表上,我要联接的列设置为一个表上的Number以及另一个表上的Number(12)。 Does this make a difference? 这有什么不同吗? The query still runs in TOAD and SQL Navigator... 该查询仍在TOAD和SQL Navigator中运行...

2 thoughts spring to mind: 我想到了两个想法:

  1. make sure you're using the correct version of the jdbc driver. 确保您使用的是正确版本的jdbc驱动程序。 Since you've said the query works in TOAD etc, this is very likely to be your problem. 由于您已经说过查询可以在TOAD等环境中使用,因此很可能是您遇到的问题。
  2. make sure you're not using any ORACLE key-words in your query as column-aliases etc 确保您没有在查询中使用任何ORACLE关键字作为列别名等

Also, from experience if your database is big/busy you've got a fair way to go before your 10g environment is stable. 同样,从经验来看,如果您的数据库很大/很忙,在10g环境稳定之前,您还有一段公平的路要走。 My recommendations: 我的建议:

  1. learn as much as you can about stats 尽可能多地了解统计信息
  2. Read the survival guides (there's lots on the net) 阅读生存指南(网上有很多)
  3. watch out for built-in jobs that re-compute status. 注意内置作业,这些作业会重新计算状态。 We got hammered 12 days after go-live because stats changes broke key query performance. 上线12天后,我们就受到了重创,因为统计数据的更改破坏了关键查询的性能。 Our testing hadn't allowed a 12 day stability test. 我们的测试不允许进行12天的稳定性测试。
  4. be aware of bind-variable-peeking if you aren't already 如果您还没有意识到,请注意bind-variable-peeking

The problem was with the following method call on the prepared statement: 问题在于对准备好的语句的以下方法调用:

ps.setEscapeProcessing(false);

Removed that and now it works fine. 删除它,现在可以正常工作了。 Don't think that was compatable with oracle 10g driver. 不要认为这与oracle 10g驱动程序兼容。 Thanks everyone for the help. 谢谢大家的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM