Number945
Number945

Reputation: 4950

Understanding defaultRowPrefetch and defaultBatchValue in Oracle JDBC Driver

I have set defaultRowPrefetch to 40 and defaultBatchValue to 15 in my Connection Object. Now I run a 'single' query which should return a 'single' row.

// define database user/password
String dbUser = "mp";
String dbPassword = "mp2";
String dbURL = "jdbc:oracle:thin:@myserver:1521:scorpian";
// specify the Properties object
Properties props = new Properties();
props.put("user", dbUser);
props.put("password", dbPassword);
props.put("defaultRowPrefetch","40");
props.put("defaultBatchValue","15");

Will the driver wait till it have 15 queries to run or run my query immediately ?Also, Since my query have to return only a single row , then how defaultRowPrefetch size comes into the picture.

Upvotes: 3

Views: 5125

Answers (1)

Jean de Lavarene
Jean de Lavarene

Reputation: 3773

defaultBatchValue is used in the context of DML batching. Since you're talking about queries that return rows I'm guessing that you're not doing JDBC DML batching at all and so this property isn't relevant. What is relevant is defaultRowPrefetch which tells the Oracle driver to fetch rows 40 by 40 (instead of the default which is 10). Given that you only care about the first row you can set the value to 1.

Upvotes: 2

Related Questions