PreparedStatement和Oracle 10g错误(PreparedStatement and Oracle 10g bug)
当我们在Java Web应用程序中调用某些SQL时,我遇到了一个很大但INTERMITTENT问题,它带有Oracle 10g中的一个错误。 我们无法快速修补或升级到11g--这似乎是第一个“愚蠢”的Oracle支持响应。 有一种解决方法,但是我在Java代码中的PreparedStatements内部执行此操作时遇到问题。
实际的错误是:
ORA-00600: internal error code, arguments: [kcblasm_1]
错误是:Oracle错误12419392
解决方法正在运行
alter session set "_hash_join_enabled" = FALSE;
在我们运行我们的错误诱导SQL之前。 但是,传统上PreparedStatement只包含一个SQL:
PreparedStatement stmt = con.prepareSelect("sql statement2");
有没有可能有一个PreparedStatement调用看起来像这样:
PreparedStatement stmt = con.prepareSelect("sql statement1; sql statement2;");
或者,这是可能的,只需要一个接一个地运行一系列顺序的PreparedStatements?
不是最好的时间来与圣诞迫近和减少支持等等,所以我真的希望有人可以提供帮助。 谢谢。
编辑 :@jonearles要求代码,所以在这里,如果它有任何用处。 可能对我们的项目非常具体,但有人可能会发现明显的缺陷诱发问题:
SELECT DISTINCT qm.validator_id, qm.QM_ID, u.EMAIL, qm.creation_dt, qm.emailed, qm.valid, qm.resolved, qm.new_obs_id, o.*, nests.*, s.*, l.*, latc.TENKM FROM query_man qm, obs o, obs_aux_aon nests, sub s, location l, l_atlas_tetrad_coverage latc, users u WHERE qm.OBS_ID = o.OBS_ID AND o.SUB_ID = s.SUB_ID AND u.user_id = qm.user_id AND o.obs_id = nests.obs_id(+) AND s.LOC_ID = l.LOC_ID AND latc.ATLAS_REGION = 'NKNE' AND (LENGTH (l.gridref) = 6 AND (SUBSTR(l.gridref,1,3) || SUBSTR(l.gridref,5,1)) = latc.TENKM OR LENGTH (l.gridref) = 4 AND l.gridref = latc.TENKM) AND qm.RESOLVED IS NULL ORDER BY latc.tenkm, l.tetrad
I have a big but INTERMITTENT problem with a bug in Oracle 10g when we call some SQL within a Java web application. We can't quickly patch or upgrade to 11g - which seems to be the first 'stupid' oracle support response. There is a work around, but I am having trouble doing this within PreparedStatements within my Java code.
The actual error is:
ORA-00600: internal error code, arguments: [kcblasm_1]
The bug is: Oracle Bug 12419392
The work around is running
alter session set "_hash_join_enabled" = FALSE;
before we run our bug-inducing SQL. However, traditionally a PreparedStatement takes in one single piece of SQL:
PreparedStatement stmt = con.prepareSelect("sql statement2");
Is it possible to have one PreparedStatement call that looks like this:
PreparedStatement stmt = con.prepareSelect("sql statement1; sql statement2;");
Or is this possible just by running a series of sequential PreparedStatements one after the other?
Not the best time to be getting this with Xmas looming and reduced support etc. etc., so I really hope someone can help. Thanks.
Edit: @jonearles asked for the code, so here it is, if it's on any use. Probably very specific to our project, but someone might spot the glaring bug-inducing issue:
SELECT DISTINCT qm.validator_id, qm.QM_ID, u.EMAIL, qm.creation_dt, qm.emailed, qm.valid, qm.resolved, qm.new_obs_id, o.*, nests.*, s.*, l.*, latc.TENKM FROM query_man qm, obs o, obs_aux_aon nests, sub s, location l, l_atlas_tetrad_coverage latc, users u WHERE qm.OBS_ID = o.OBS_ID AND o.SUB_ID = s.SUB_ID AND u.user_id = qm.user_id AND o.obs_id = nests.obs_id(+) AND s.LOC_ID = l.LOC_ID AND latc.ATLAS_REGION = 'NKNE' AND (LENGTH (l.gridref) = 6 AND (SUBSTR(l.gridref,1,3) || SUBSTR(l.gridref,5,1)) = latc.TENKM OR LENGTH (l.gridref) = 4 AND l.gridref = latc.TENKM) AND qm.RESOLVED IS NULL ORDER BY latc.tenkm, l.tetrad
原文:https://stackoverflow.com/questions/8444702
最满意答案
你可以通过反思来调用它
var method = typeof(MockRepository).GetMethod("GenerateMock").MakeGenericMethod(semiknown.FieldType); var mock_semiknown = method.Invoke(null, null);
You can call it by reflection
var method = typeof(MockRepository).GetMethod("GenerateMock").MakeGenericMethod(semiknown.FieldType); var mock_semiknown = method.Invoke(null, null);
相关问答
更多-
你可以通过反思来调用它 var method = typeof(MockRepository).GetMethod("GenerateMock").MakeGenericMethod(semiknown.FieldType); var mock_semiknown = method.Invoke(null, null); You can call it by reflection var method = typeof(MockRepository).GetMethod("GenerateMock").M ...
-
每个方法的Mockito默认实现由RETURNS_DEFAULTS给出,除非另有配置,否则延迟到ReturnsEmptyValues : 每个Mockito模拟的默认答案。 返回原始返回方法的适当原语 返回原始包装类的一致值(例如,int-returning方法返回0,Integer-returns方法返回0) 返回集合返回方法的空集合(适用于最常用的集合类型) 返回toString()方法的mock的描述 如果引用等于则返回零,否则对于Comparable#compareTo(T other)方法返回非零 ...
-
不,这是不可能的。 泛型也称为“擦除”,因为它们在编译期间从类中删除。 泛型是在运行时不存在的编译时功能,因此无法检索此信息。 但有一个workaroud。 创建特殊字段Class> type; 并把那个类型哟希望检索。 然后只需检索它。 顺便说一句,你已经有了这个解决方案。 你有一个protected E e; 。 因此,您可以使用e.getClass()来确定类型。 No, it is impossible. Generics are also called "erasures" because t ...
-
我没有做任何Android开发,所以我不确定它的类加载器的细微差别,但在一般的Java编程中,由不同的类加载器加载的两个类是不一样的......即使它们是从同一个类加载的“文件”。 因此,如果您在“您的”类加载器中加载接口X ,然后从“外部”类加载器获取似乎实现类X的对象,则对“您的” X将失败。 为了使它工作, X必须从类加载器加载,该加载器是另外两个加载器的公共父类。 I haven't done any Android development, so I'm not sure of the nuanc ...
-
如何基于接口创建一个模拟对象并设置只读属性?(How to create a mock object based on an interface and set a read-only property?)[2023-08-22]
在这里找到答案http://haacked.com/archive/2007/05/04/setting-propertybehavior-on-all-properties-with-rhino-mocks.aspx 。 简单,而不是 aBatchItem.ID=1; 使用: SetupResult.For(aBatchItem.ID).Return(1); Even better if using rhino mocks 3.5: aBatch.Stub(x => x.ID).Return(0); -
除了通常没有一个完美的测试解决方案之外,我首先会去模拟COM对象:应该有一个可用的接口,并且您可能想要测试它上面的所有东西。 如果Table包含非平凡的代码(例如在Eval() ;任何带有条件的东西;或者例如使用Culture解析),您可能想要像您在示例中显示的那样对其进行模拟。 Beyond the fact that there is usually no one perfect testing solution, I'd first go for mocking the COM object: the ...
-
获取datagrid以使用反射创建具有未知类型的列(Get datagrid to create columns with unknown types using reflection)[2022-03-26]
答案最终取代了 public ObservableCollectionTransactions 同 public ObservableCollection -
为了实例化泛型类型,您需要知道应该替换其类型参数的实际值(类型)。 GetGenericArguments()方法是一种反射形式,它只为您提供类型参数 ,而不是它们的实际值。 价值取决于你......这是仿制药的全部要点。 如果item是类似List
的类型,则item.GetGenericArguments()将返回一个数组,其中包含表示类型参数T的伪“type”(其IsGenericParameter属性设置为true)。 因此,将该参数类型传递回item.MakeGenericType()将只创建 ... -
你应该初始化本地人: foreach (var method in interfaceType.GetMethods()) { var args = method.GetParameters(); var methodImpl = type.DefineMethod(method.Name, MethodAttributes.Public | MethodAttributes.Virtual, method.ReturnType, (from arg in args select arg.P ...
-
据我所知和这个相关问题的答案,不可能在运行时创建新类型。 您可能想尝试go-eval包 ,该包应支持在其Universe中定义新类型。 To the best of my knowledge and the answers of this related question, it is not possible to create new types at runtime. You may want to try the go-eval package which should support defini ...