简体   繁体   English

同一数据库上的相同查询在OAS 10.1.3上给出了不同的结果

[英]Same query on same database gives different results on OAS 10.1.3

I'm seeing something odd when I run a query in an application deployed in Oracle Application Server 10.1.3, with Oracle10g. 当我在Oracle应用服务器10.1.3中使用Oracle10g部署的应用程序中运行查询时,我看到了一些奇怪的东西。

When I run a statement against the database directly (eg a standalone app that calls a DAO implemented with hibernate) I see the following: 当我直接对数据库运行语句时(例如,调用使用hibernate实现的DAO的独立应用程序),我看到以下内容:

select 
    documentco0_.CONTENT_ID as CONTENT1_63_0_, 
    documentco0_.TSTAMP as TSTAMP63_0_, 
    documentco0_.CONTENT as CONTENT63_0_ 
from 
    MySchema.MyTable documentco0_ 
where 
    documentco0_.CONTENT_ID=? 

[main] TRACE org.hibernate.type.LongType - binding '1768334' to parameter: 1 
[main] TRACE org.hibernate.type.TimestampType - returning '2013-08-05 17:31:32' as     column: TSTAMP63_0_ 
[main] TRACE org.hibernate.type.BinaryType - returning '7f587f608090cac6c9c68081818180b380b380807f5b80c3807f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f40808b8880918091818191807f44809f8080818581818181818180808080808080808182838485868788898a8b7f44803590808281838382848385858484808081fd8182838084918592a1b1c18693d1e187a2f194b201112188a3c2314195d25170a4b3e2f202898a969798999aa5a6a7a8a9aab4b5b6b7b8b9bac3c4c5c6c7c8c9cad3d4d5d6d7d8d9dae3e4e5e6e7e8e9eaf3f4f5f6f7f8f9fa030405060708090a12131415161718191a22232425262728292a32333435363738393a42434445464748494a52535455565758595a6162636465666768696a7172737475767778797a7f5a808881818080bf80fef947bf520c730eff25ada7bd007c7f807a460efd87677f805625220aab7f59' as column: CONTENT63_0_ 

The same DAO operation when run within the application server however returns the following: 在应用程序服务器中运行时,相同的DAO操作会返回以下内容:

select 
    documentco0_.CONTENT_ID as CONTENT1_63_0_, 
    documentco0_.TSTAMP as TSTAMP63_0_, 
    documentco0_.CONTENT as CONTENT63_0_ 
from 
    MySchema.MyTable documentco0_ 
where 
    documentco0_.CONTENT_ID=? 

2013-08-06 12:49:46,484 TRACE [AJPRequestHandler-RMICallHandler-12] myuser:4 (NullableType.java:133 nullSafeSet()) - binding '1768334' to parameter: 1 
2013-08-06 12:49:46,500 TRACE [AJPRequestHandler-RMICallHandler-12] myuser:4 (NullableType.java:172 nullSafeGet()) - returning '2013-08-05 17:31:32' as column: TSTAMP63_0_ 
2013-08-06 12:49:46,500 TRACE [AJPRequestHandler-RMICallHandler-12] myuser:4 (NullableType.java:172 nullSafeGet()) - returning '80d48081818c808080818080808180808099ff0c809a5c9d809a5c9c80828082808080817f587f608090cac6c9c68081808080804818f7ef8081808080808080808080808080808080808080809a5c9c83408c508081' as column: CONTENT63_0_ 

You can see that the identifier and timestamp are the same in both cases, but the content blob is different: 360 bytes in the first case and 86 bytes in the second case. 您可以看到标识符和时间戳在两种情况下都相同,但内容blob不同:第一种情况下为360字节,第二种情况下为86字节。

The stand-alone application uses a BasicDataSource , while the application on the server uses a JNDI data source. 独立应用程序使用BasicDataSource ,而服务器上的应用程序使用JNDI数据源。 I have verified that the BasicDataSource contains the same JDBC url that is used in the JNDI data source. 我已经验证BasicDataSource包含在JNDI数据源中使用的相同JDBC URL。 Both data sources use the same credentials. 两个数据源都使用相同的凭据。

The database operation in the application server has a different trace output, using NullableType::nullSafeGet() to display information instead of org.hibernate.type tracing. 应用程序服务器中的数据库操作具有不同的跟踪输出,使用NullableType::nullSafeGet()来显示信息而不是org.hibernate.type跟踪。 I'm not sure if that is relevant. 我不确定这是否相关。

Is there something obvious that I am overlooking here? 有什么明显的东西我在这里俯瞰吗? I can't see why I am getting different results when running the same query on the same database. 在同一个数据库上运行相同的查询时,我无法理解为什么会得到不同的结果。

edit: on OAS I have configured a JDBC ConnectionPool, that uses connection factory class oracle.jdbc.pool.OracleDataSource , and the JDBC data source is a managed data source pointing to that connection pool. 编辑:在OAS上我已经配置了一个JDBC ConnectionPool,它使用连接工厂类oracle.jdbc.pool.OracleDataSource ,而JDBC数据源是指向该连接池的托管数据源。

I'm thinking there may be an issue with different Oracle JDBC drivers? 我想不同的Oracle JDBC驱动程序可能存在问题? The BasicDataSource for the stand-alone app uses the JDBC driver oracle.jdbc.driver.OracleDriver and the dialect org.hibernate.dialect.Oracle10gDialect . BasicDataSource为独立的应用程序使用JDBC驱动oracle.jdbc.driver.OracleDriver和方言org.hibernate.dialect.Oracle10gDialect I can't see any place in OAS administration that shows the equivalent values. 我看不到OAS管理中显示等效值的任何地方。

Please have a look at this article 请看一下这篇文章

Looks like, for some reason, OAS returns only 86 bytes of the BLOB value, unless you specify an Lob handler on your configuration. 看起来,由于某种原因,OAS只返回86字节的BLOB值,除非您在配置上指定了Lob处理程序。

You can also have more info on this thread of CodeRanch describing the same issue 您还可以在CodeRanch的此线程中获得更多信息,描述相同的问题

Hope this helps! 希望这可以帮助!

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

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