DB_DBT_MALLOC was set when secondary db's callback function was called!
I have a secondary db associated with a primary db,when i insert some test records into primary db
,i saw my sdb_callback was called twice!the first call with the correct data,but the seocond call
was with wrong data,data.size was wrong ,with a big value and flags was set to DB_DBT_MALLOC ,
what should i do when the callback was called twice?just return DB_DONOTINDEX?
i modified the example code from source code/example_c/bench_001.c,make the bulk_fill the DB to
have a secondary as following
int sdb_callback(DB sdbp, / secondary db handle */
const DBT pkey, / primary db record's key */
const DBT pdata, / primary db record's data */
DBT skey) / secondary db record's key */
if(pdata->flags & DB_DBT_MALLOC)
fprintf(stderr,"DB_DBT_MALLOC fired size:%d ksize:%d \r\n",pdata->size,pkey->size);
return DB_DONOTINDEX;
}else
return DB_DONOTINDEX;
FOR work WITH secondary db,i comment following out
//if ((ret = dbp->set_flags(dbp, DB_DUP)) != 0) {
// dbp->err(dbp, ret, "set_flags");
// goto err;
char sdb_filename[256];
sprintf(sdb_filename, "s_%s",DATABASE );
if ((ret = db_create(&sdbp, dbenv, 0)) != 0) {
dbp->err(dbp, ret, "crate");
exit(EXIT_FAILURE);
/* set page size */
if((ret = sdbp->set_pagesize(sdbp, pagesize)) != 0){
dbp->err(dbp, ret, "crate");
exit(EXIT_FAILURE);
/* allow sorted duplicates. */
/* try to open db*/
ret = sdbp->open(sdbp, NULL, sdb_filename, NULL, DB_BTREE, DB_CREATE, 0664);
if(ret != 0)
dbp->err(dbp, ret, "%s: sdb open", DATABASE);
dbp->associate(dbp, NULL, sdbp, sdb_callback, 0);
then i run bulk_fill test,DB_DBT_MALLOC was OFTEN fired,but not every put!
Edited by: feiman on May 23, 2010 4:35 AM
following are codes from example_c bench_001.c
i run ./a.out -B
then it appears that when one record input to main db,secondary db's callback was called twice,except the FIRST record!!!
#include <sys/types.h>
#include <sys/time.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
extern int getopt(int, char * const *, const char *);
#else
#include <unistd.h>
#endif
#include <db.h>
#define DATABASE "bench_001.db"
int bulk_fill(DB_ENV *, DB *, int, u_int, int, int, int *, int *);
int compare_int(DB *, const DBT *, const DBT *);
DB_ENV db_init(char , char *, u_int, int);
int main(int, char *[]);
void usage(void);
const char
progname = "bench_001"; / Program name. */
int
sdb_callback(DB sdbp, / secondary db handle */
const DBT pkey, / primary db record's key */
const DBT pdata, / primary db record's data */
DBT skey) / secondary db record's key */
skey->data = pkey->data;
skey->size = pkey->size;
fprintf(stderr,"callback called size:%d ksize:%d \r\n",pdata->size,pkey->size);
return 0;
* db_init --
* Initialize the environment.
DB_ENV *
db_init(home, prefix, cachesize, txn)
char home, prefix;
u_int cachesize;
int txn;
DB_ENV *dbenv;
u_int32_t flags;
int ret;
if ((ret = db_env_create(&dbenv, 0)) != 0) {
dbenv->err(dbenv, ret, "db_env_create");
return (NULL);
dbenv->set_errfile(dbenv, stderr);
dbenv->set_errpfx(dbenv, prefix);
(void)dbenv->set_cachesize(dbenv, 0,
cachesize == 0 ? 50 * 1024 * 1024 : (u_int32_t)cachesize, 0);
flags = DB_CREATE | DB_INIT_MPOOL;
if (txn)
flags |= DB_INIT_TXN | DB_INIT_LOCK;
if ((ret = dbenv->open(dbenv, home, flags, 0)) != 0) {
dbenv->err(dbenv, ret, "DB_ENV->open: %s", home);
(void)dbenv->close(dbenv, 0);
return (NULL);
return (dbenv);
* bulk_fill - bulk_fill a db
* Since we open/created the db with transactions (potentially),
* we need to populate it with transactions. We'll bundle the puts
* UPDATES_PER_BULK_PUT to a transaction.
#define UPDATES_PER_BULK_PUT 3
int
bulk_fill(dbenv, dbp, txn, datalen, num, dups, countp, iterp)
DB_ENV *dbenv;
DB *dbp;
u_int datalen;
int txn, num, dups;
int countp, iterp;
DBT key, data;
u_int32_t flag = 0;
DB_TXN *txnp;
struct data {
int id;
char str[1];
} *data_val;
int count, i, iter, ret;
void ptrk, ptrd;
int iCnt = 0;
time_t now,then;
time(&now);
time(&then);
* Insert records into the database, where the key is the user
* input and the data is the user input in reverse order.
txnp = NULL;
ret = 0;
count = 0;
iter = 0;
ptrk = ptrd = NULL;
data_val = malloc(datalen);
memcpy(data_val->str, "0123456789012345678901234567890123456789",
datalen - sizeof(data_val->id));
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
* Need to account for proper buffer size,
* The buffer must be at least as large as the page size of
* the underlying database, aligned for unsigned integer
* access, and be a multiple of 1024 bytes in size.
key.ulen = (u_int32_t)UPDATES_PER_BULK_PUT *
sizeof(u_int32_t) * datalen * 1024;
key.flags = DB_DBT_USERMEM | DB_DBT_BULK;
key.data = malloc(key.ulen);
data.ulen = (u_int32_t)UPDATES_PER_BULK_PUT *
(u_int32_t)datalen * 1024;
data.flags = DB_DBT_USERMEM | DB_DBT_BULK;
data.data = malloc(data.ulen);
if (dups)
flag |= DB_MULTIPLE;
else
flag |= DB_MULTIPLE_KEY;
DB_MULTIPLE_WRITE_INIT(ptrk, &key);
if (dups)
DB_MULTIPLE_WRITE_INIT(ptrd, &data);
for (i = 0; i < num; i++) {
if (txn != 0 && (i+1) % UPDATES_PER_BULK_PUT == 0) {
if (txnp != NULL) {
ret = txnp->commit(txnp, 0);
txnp = NULL;
if (ret != 0)
goto err;
if ((ret =
dbenv->txn_begin(dbenv, NULL, &txnp, 0)) != 0)
goto err;
data_val->id = 0;
do {
if (dups) {
DB_MULTIPLE_WRITE_NEXT(ptrk, &key,
&i, sizeof(i));
assert(ptrk != NULL);
DB_MULTIPLE_WRITE_NEXT(ptrd, &data,
data_val, datalen);
assert(ptrd != NULL);
else {
DB_MULTIPLE_KEY_WRITE_NEXT(ptrk,
&key, &i, sizeof(i), data_val, datalen);
assert(ptrk != NULL);
if ((i+1) % UPDATES_PER_BULK_PUT == 0) {
switch (ret = dbp->put(dbp, txnp, &key, &data, flag)) {
case 0:
iter++;
free (key.data);
free (data.data);
memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));
key.ulen =
(u_int32_t)UPDATES_PER_BULK_PUT *
sizeof(u_int32_t) * datalen * 1024;
key.flags = DB_DBT_USERMEM|DB_DBT_BULK;
key.data = malloc(key.ulen);
data.ulen =
(u_int32_t)UPDATES_PER_BULK_PUT *
(u_int32_t)datalen * 1024;
data.flags =
DB_DBT_USERMEM|DB_DBT_BULK;
data.data = malloc(data.ulen);
DB_MULTIPLE_WRITE_INIT(ptrk, &key);
if (dups)
DB_MULTIPLE_WRITE_INIT(ptrd, &data);
break;
default:
dbp->err(dbp, ret, "Bulk DB->put");
free (key.data);
free (data.data);
goto err;
count++;
} while (++data_val->id < dups);
if ((num % UPDATES_PER_BULK_PUT) != 0) {
switch (ret = dbp->put(dbp, txnp, &key, &data, flag)) {
case 0:
iter++;
free (key.data);
free (data.data);
break;
default:
free (key.data);
free (data.data);
dbp->err(dbp, ret, "Bulk DB->put");
goto err;
if (txnp != NULL)
ret = txnp->commit(txnp, 0);
printf("%d\n", count);
*countp = count;
*iterp = iter;
return (ret);
err: if (txnp != NULL)
(void)txnp->abort(txnp);
return (ret);
int
main(argc, argv)
int argc;
char *argv[];
extern char *optarg;
extern int optind;
DB dbp,sdbp;
DB_ENV *dbenv;
DB_TXN *txnp;
struct timeval start_time, end_time;
double secs;
u_int cache, datalen, pagesize;
int biter, ch, count, dups, env, init, iter, num;
int ret, rflag, txn, bulk, delete;
txnp = NULL;
datalen = 20;
iter = num = 100;
env = 1;
dups = init = rflag = txn = bulk = delete = 0;
pagesize = 65536;
cache = 1000 * pagesize;
while ((ch = getopt(argc, argv, "c:d:EIi:l:n:p:RTBD")) != EOF)
switch (ch) {
case 'c':
cache = (u_int)atoi(optarg);
break;
case 'd':
dups = atoi(optarg);
break;
case 'E':
env = 0;
break;
case 'I':
init = 1;
break;
case 'i':
iter = atoi(optarg);
break;
case 'l':
datalen = (u_int)atoi(optarg);
break;
case 'n':
num = atoi(optarg);
break;
case 'p':
pagesize = (u_int)atoi(optarg);
break;
case 'R':
rflag = 1;
break;
case 'T':
txn = 1;
break;
case 'B':
bulk = 1;
break;
case 'D':
delete = 1;
break;
case '?':
default:
usage();
argc -= optind;
argv += optind;
/* Remove the previous database. */
if (!rflag) {
if (env)
(void)system("rm -rf BENCH_001; mkdir BENCH_001");
else
(void)unlink(DATABASE);
dbenv = NULL;
if (env == 1 &&
(dbenv = db_init("BENCH_001", "bench_001", cache, txn)) == NULL)
return (-1);
if (init)
exit(0);
/* Create and initialize database object, open the database. */
if ((ret = db_create(&dbp, dbenv, 0)) != 0) {
fprintf(stderr,
"%s: db_create: %s\n", progname, db_strerror(ret));
exit(EXIT_FAILURE);
dbp->set_errfile(dbp, stderr);
dbp->set_errpfx(dbp, progname);
if ((ret = dbp->set_bt_compare(dbp, compare_int)) != 0) {
dbp->err(dbp, ret, "set_bt_compare");
goto err;
if ((ret = dbp->set_pagesize(dbp, pagesize)) != 0) {
dbp->err(dbp, ret, "set_pagesize");
goto err;
if (dups && (ret = dbp->set_flags(dbp, DB_DUP)) != 0) {
dbp->err(dbp, ret, "set_flags");
goto err;
if (env == 0 && (ret = dbp->set_cachesize(dbp, 0, cache, 0)) != 0) {
dbp->err(dbp, ret, "set_cachesize");
goto err;
//if ((ret = dbp->set_flags(dbp, DB_DUP)) != 0) {
// dbp->err(dbp, ret, "set_flags");
// goto err;
if (txn != 0)
if ((ret = dbenv->txn_begin(dbenv, NULL, &txnp, 0)) != 0)
goto err;
if ((ret = dbp->open(
dbp, txnp, DATABASE, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) {
dbp->err(dbp, ret, "%s: open", DATABASE);
if (txnp != NULL)
(void)txnp->abort(txnp);
goto err;
char sdb_filename[256];
sprintf(sdb_filename, "s_%s",DATABASE );
if ((ret = db_create(&sdbp, dbenv, 0)) != 0) {
dbp->err(dbp, ret, "crate");
exit(EXIT_FAILURE);
/* set page size */
if((ret = sdbp->set_pagesize(sdbp, pagesize)) != 0){
dbp->err(dbp, ret, "crate");
exit(EXIT_FAILURE);
/* allow sorted duplicates. */
/* try to open db*/
ret = sdbp->open(sdbp, NULL, sdb_filename, NULL, DB_BTREE, DB_CREATE, 0664);
if(ret != 0)
dbp->err(dbp, ret, "%s: sdb open", DATABASE);
dbp->associate(dbp, NULL, sdbp, sdb_callback, 0);
if (txnp != NULL)
ret = txnp->commit(txnp, 0);
txnp = NULL;
if (ret != 0)
goto err;
if (bulk) {
/* Time the get loop. */
(void)gettimeofday(&start_time, NULL);
if ((ret = bulk_fill(dbenv, dbp, txn, datalen,
num, dups, &count, &biter)) != 0)
goto err;
(void)gettimeofday(&end_time, NULL);
secs =
(((double)end_time.tv_sec * 1000000 +
end_time.tv_usec) -
((double)start_time.tv_sec * 1000000 +
start_time.tv_usec))
/ 1000000;
printf("%d records put using %d batches",
count, biter);
printf(" in %.2f seconds: ", secs);
printf("%.0f records/second\n", (double)count / secs);
/* Close everything down. */
if ((ret = dbp->close(dbp, rflag ? DB_NOSYNC : 0)) != 0) {
fprintf(stderr,
"%s: DB->close: %s\n", progname, db_strerror(ret));
return (1);
return (ret);
err: (void)dbp->close(dbp, 0);
return (1);
int
compare_int(dbp, a, b)
DB *dbp;
const DBT a, b;
int ai, bi;
dbp = dbp; /* Lint. */
* Returns:
* < 0 if a < b
* = 0 if a = b
* > 0 if a > b
memcpy(&ai, a->data, sizeof(int));
memcpy(&bi, b->data, sizeof(int));
return (ai - bi);
void
usage()
(void)fprintf(stderr, "usage: %s %s\n\t%s\n",
progname, "[-EIRTBE] [-c cachesize] [-d dups]",
"[-i iterations] [-l datalen] [-n keys] [-p pagesize]");
exit(EXIT_FAILURE);
}
Similar Messages
-
Ajax:callback function not called for every readystatechange of the request
Author: khk Posts: 2 Registered: 2/17/06
Feb 17, 2006 11:04 PM
Hi
I am working with an ajax program.
In that i have defined a callback funtion
but that function is not being called for every readystatechange of the request object for the first request .
but it is working fine from the second request.
function find(start,number){
var nameField=document.getElementById("text1").value;
var starting=start;
var total=number;
if(form1.criteria[0].checked) {
http.open("GET", url + escape(nameField)+"¶m2="+escape("exact")+"¶m4="+escape(starting)+"¶m5="+escape(number));
else if(form1.criteria[2].checked) {
http.open("GET", url + escape(nameField)+"¶m2="+escape("prefix")+"¶m4="+escape(starting)+"¶m5="+escape(number));
http.onreadystatechange = callback2;
http.send(null);
function callback2(){
if (http.readyState == 4) {//request state
if(http.status==200){
var message=http.responseXML;
alert(http.responseText);
Parse2(message);
}else{
alert("response is not completed");
}else{
alert("request state is :-"+http.readyState);
}Triple post.
You have been answered here: http://forum.java.sun.com/thread.jspa?threadID=709676 -
Callback function is called with sys user context.
1. Create AQ Queue table
2. Create AQ Queue "MyQueue"
3. Start Queue "MyQueue"
4. Register "Subscriber1"
5. Register "MyQueue"."Subscriber1" with Notification URL : PLSQL:\\Mypackage.SP_Callback
Till here everything is fine...
6. Enqueue message into "MyQueue" with "Subscriber1" as recipient.
7. Now AQ notification is fired and as a result Its calling "Mypackage.SP_Callback".
Here the problem is "Mypackage.SP_Callback" is called from SYS user context. i.e if i capture the dbuser its "SYS" who is invoking the AQ notification call back method, "Mypackage.SP_Callback".
Do i have any settings so that "Mypackage.SP_Callback" is called with a specific user account instead of "SYS".
Please help me...
Edited by: user13421038 on Jun 30, 2011 5:06 AMHello,
From what is mentioned in this thread this issue is the same as that discussed in Note 552771.1. The issue should be resolved in 10.2.0.4 and 11.1.0.6 onwards.
Thanks
Peter -
Call Java Method from Callback function
I am writing a JNI wrapper in c++ for a particular event driven DLL. The DLL makes a network connection to another device and then calls a callback function when events are raised on the device. The DLL has 3 basic functions: connect, disconnect, and registerEventListener. RegisterEventListener takes a function pointer which is called each time an event is raised on the device.
My wrapper DLL exposes connect and disconnect functions via JNI. I can call these functions just fine from my Java code. Now the question... How do I call a Java method from my c++ callback function? I can call a Java method using env->CallXXXMethod(...) from within a function that is accessible to Java but I don't have access to the JNI parameters in my Callback function.
So how do I call a Java method from a callback function? If this cannot be done then what is the "right way" to handle native event notification with JNI?jschell wrote:
JNI parameters? Meaning what exactly?
General outline of a callback
1. Entry
2. Get the VM, env - there are methods for this
3. Attach the thread
4. Get a java object - how depends on what you are doing, but create it or a static reference.
5. Get the java method
6. Call the java method.That is exactly correct. The callback function is called from a separate thread so using a cached pointer to JNIEnv, obtained from the original native method, crashes the JVM. The jmethodID and jclass objects (which are needed to call the static Java method) can be cached without problem. The following is the code I used to attach the current thread and call my static method.
void MyClass::onEvent(int system_id, char* data)
//get a pointer to the Java Environment
JNIEnv *env;
jvm->AttachCurrentThread((void **)&env, NULL);
//Call the Java method with the newly aquired data
jstring js = env->NewStringUTF(data);
env->CallStaticVoidMethod(cls, mid, system_id, js);
}My last question is about cleanup in this function. When I use NewStringUTF to "convert" my char* to jstring do I need to do anything special to clean up or will the Java garbage collector take care of it since the jstring is being passed to a Java method?
Thanks for you help -
When try to use callback function, it's not working well.
I'm expecting to hear ring tone when successful re-dial but now is listening to my own voice.
It's seem in the background process is dialling but the audio is not link to the dial tone and just listen to my own mic/voice.
I got to hang up and wait the other party to call me.When the call fails (interrupts or even don't connect) the phone suggests you to "call back" or cancel.
When you click "call back", it shows you the connection screen saying "calling" but if you put the phone to your ear, you'll hear your own voice instead if tones. It's like my mic is on and i hear it in my speaker/headphone.
It's not about carrier since it have never happened on any other phone.
Anyway, they always say "change your phone".
If i press "cancel" instead of "call back" and dial the number as usual, via contacts say, everything is fine. So the problem appears only when using "call back" -
How do I wipe everything off, and go back to the way the phone was set when I got it?
How do I wipe everything off, and go back to the way the phone was set when I got it? I am thinking that might be the only way to fix my wifi issue. Thanks!
Hello, if you havent tried the doesktop manager option, you can do it from the device aswell... Just make sure you save all your contacts to your SIM.
you can go into your Security Options (in Options menu) and select wipe handheld.
1). Please thank those who help you by clicking the beside the 'Reply' button.
2). If your issue has been solved, please resolve it by marking "Accept as Solution" on the correct post!
3). Remember to have fun! We are all in this together!
4). Follow me on -
I have two email accts. set in my iphone,one is the default setting.when I send an email it shows that it was sent from a 3rd email acct. that I no longer use,and had been deleted from my phone?
Install ClamXav and run a scan with that. It should pick up any trojans.
17" 2.2GHz i7 Quad-Core MacBook Pro 8G RAM 750G HD + OCZ Vertex 3 SSD Boot HD
Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101 -
Queue with callback function - strange behaviour when using max_retries
Hi,
I hope someone can tell me what is wrong or can explain the following strange behaviour to me.
I am using one queue with a registered callback function. To test the behavoiur in case of an error I tested different settings, with or without explicit exception queue and with or without parameter max_retries.
Database Version is 11.2.0.2. Enterprise Edition
I enqueue 10 messages in a loop.
I define no exception queue and do not set max_retries
==> all messages stay in the queuetable with q_name = AQ$_... (implicit exception queue) and retry_count = 5
I define no exception queue and set max_retries = 4
==> 1 message stays in the queuetable with q_name = AQ$_... (implicit exception queue) and retry_count = 4
9 messages stay in the queuetable with q_name = nomal queue name and retry_count = 0
I define an exception queue and set max_retries = 4
==> 1 message is transfered to the Exception Queuetable with retry_count = 4
9 messages stay in the normal Queuetable and retry_count = 0
I define an exception queue and do not set max_retries
==> all 10 messages are transferred to the Exception Queuetable with retry_count = 5
I have no explanation for the behaviour in case 2 and case 3.
To create the queue and the callback I use this code (reduced to minimum):
begin
DBMS_AQADM.CREATE_QUEUE_TABLE(Queue_table => 'TESTUSER.TEST_TABELLE'
, Queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE'
, sort_list => 'enq_time'
, multiple_consumers => FALSE
DBMS_AQADM.CREATE_QUEUE( queue_name => 'TESTUSER.TEST_QUEUE'
, queue_table => 'TESTUSER.TEST_TABELLE'
-- , max_retries => 4 uncomment this line to set max_retries
-- uncomment the following Block to use an explicit Exception Queue
/* DBMS_AQADM.CREATE_QUEUE_TABLE(Queue_table => 'TESTUSER.TEST_TABELLE_EXC'
, Queue_payload_type => 'SYS.AQ$_JMS_TEXT_MESSAGE'
, sort_list => 'enq_time'
, multiple_consumers => FALSE
DBMS_AQADM.CREATE_QUEUE( queue_name => 'TESTUSER.TEST_QUEUE_EXC'
, queue_table => 'TESTUSER.TEST_TABELLE_EXC'
, queue_type => dbms_aqadm.EXCEPTION_QUEUE);
DBMS_AQADM.START_QUEUE('TESTUSER.TEST_QUEUE');
end;
create or replace procedure test_procedure
(context RAW
,reginfo sys.AQ$_reg_info
,descr sys.AQ$_descriptor
,payload VARCHAR2
,payloadl NUMBER
) authid definer
IS
-- für Queue
dequeue_options DBMS_AQ.dequeue_options_t;
message_prop DBMS_AQ.message_properties_t;
message_hdl raw(16);
message sys.aq$_jms_text_message;
l_daten VARCHAR2(32767);
ex_hugo EXCEPTION;
BEGIN
dequeue_options.msgid := descr.msg_id;
dequeue_options.consumer_name := descr.consumer_name;
dbms_aq.dequeue(descr.queue_name, dequeue_options, message_prop, message, message_hdl);
-- to provoke an error
RAISE ex_hugo;
-- regurlar coding
commit;
exception
when others then
rollback;
RAISE;
end;
DECLARE
reginfo1 sys.aq$_reg_info;
reginfolist sys.aq$_reg_info_list;
BEGIN
reginfo1 := sys.aq$_reg_info('TESTUSER.TEST_QUEUE', DBMS_AQ.NAMESPACE_AQ, 'plsql://TESTUSER.TEST_PROCEDURE?PR=0',HEXTORAW('FF'));
reginfolist := sys.aq$_reg_info_list(reginfo1);
sys.dbms_aq.register(reginfolist, 1);
commit;
END;
to enqueue my messages i use:
DECLARE
message sys.aq$_jms_text_message;
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
msgid raw(16);
v_daten clob;
BEGIN
message := sys.aq$_jms_text_message.construct;
for i in 1..10
loop
v_daten := '{ dummy_text }';
message.set_text(v_daten);
-- uncomment the following line to use an explicit Exception Queue
-- message_properties.exception_queue := 'TESTUSER.TEST_QUEUE_EXC';
dbms_aq.enqueue(queue_name => 'TESTUSER.TEST_QUEUE',
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message,
msgid => msgid);
message.clear_properties();
end loop;
commit;
END;Hi Chris,
I tried to reproduce your complaint, but was unable to. I didnt use auditting however, just a series of "select user from dual" with proxy authentication. You might want to see if you can put together a small complete testcase for this and open a sr with support.
Cheers
Greg -
Callback function may be NULL only when database handles are read-only
Hi,
I am getting some errors when trying to run my java code that will try to open a few cursors and join them to fetch the data.
ath .:/usr/src/db-4.7.25.NC/java/src:/usr/local/BerkeleyDB.4.7/lib/db.jar bdbtest
MyDbs: Callback function may be NULL only when database handles are read-only
Error on inventory secondary cursor:
java.lang.IllegalArgumentException: Invalid argument: Callback function may be NULL only when database handles are read-only
What does that error mean? How can I resolve it? I am following the sample program and I can't find anything related.
Here is my code.
import com.sleepycat.db.DatabaseException;
import com.sleepycat.db.Database;
import com.sleepycat.db.SecondaryDatabase;
import com.sleepycat.db.DatabaseConfig;
import com.sleepycat.db.DatabaseType;
import java.io.FileNotFoundException;
import com.sleepycat.db.DatabaseEntry;
import com.sleepycat.db.SecondaryCursor;
import com.sleepycat.db.Cursor;
import com.sleepycat.db.DatabaseException;
import com.sleepycat.db.LockMode;
import com.sleepycat.db.OperationStatus;
import com.sleepycat.db.SecondaryCursor;
import com.sleepycat.db.SecondaryConfig;
import com.sleepycat.bind.EntryBinding;
import com.sleepycat.bind.serial.SerialBinding;
import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.db.Cursor;
import com.sleepycat.db.DatabaseEntry;
import com.sleepycat.db.DatabaseException;
import com.sleepycat.db.LockMode;
import com.sleepycat.db.OperationStatus;
import com.sleepycat.db.SecondaryCursor;
public class bdbtest {
public static void main(String args[]) {
SecondaryDatabase myDatabase = null;
Database primDB = null;
Cursor cursor = null;
try {
// Open the database. Create it if it does not already exist.
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setErrorStream(System.err);
dbConfig.setErrorPrefix("MyDbs");
dbConfig.setType(DatabaseType.BTREE);
dbConfig.setAllowCreate(true);
SecondaryConfig mySecConfig = new SecondaryConfig();
mySecConfig.setErrorStream(System.err);
mySecConfig.setErrorPrefix("MyDbs");
mySecConfig.setType(DatabaseType.BTREE);
mySecConfig.setAllowCreate(true);
primDB = new Database("/tmp/bdb_ca_db.db",
"bdb_ca_db",
dbConfig);
dbConfig.setAllowCreate(true);
myDatabase = new SecondaryDatabase("/tmp/bdb_ca_sdb.db",
"ca_sdb_res_alias",
primDB,
mySecConfig);
String res ="in-1";
SecondaryCursor secCursor = null;
DatabaseEntry searchKey =
new DatabaseEntry(res.getBytes("UTF-8"));
DatabaseEntry foundKey = new DatabaseEntry();
DatabaseEntry foundData = new DatabaseEntry();
secCursor =
myDatabase.openSecondaryCursor(null, config);
// Search for the secondary database entry.
OperationStatus retVal =
secCursor.getSearchKey(searchKey, foundKey,
foundData, LockMode.DEFAULT);
if (retVal == OperationStatus.SUCCESS){
System.out.println("succ");
}else {
System.out.println("fail");
while (retVal == OperationStatus.SUCCESS) {
String keyString = new String(foundKey.getData(), "UTF-8");
String dataString = new String(foundData.getData(), "UTF-8");
System.out.println("Key | Data : " + keyString + " | " +
dataString + "");
secCursor.getNextDup(searchKey, foundKey,foundData, LockMode.DEFAULT);
} catch (Exception e) {
System.err.println("Error on inventory secondary cursor:");
System.err.println(e.toString());
e.printStackTrace();
finally {
// Make sure to close the cursor
try {
cursor.close();
}catch (com.sleepycat.db.DatabaseException e) {
System.out.println("All done.");
}Hi,
The error is because either the primary database or the secondary database is configured as read only and the callback to create the secondary keys is null. A quick glance of the code, it appears as if you did not set up the secondary database correctly. In the Getting Started Guide for JAVA API chap 10, we have detailed information on what needs to be done as well as a code example. Please refer to http://www.oracle.com/technology/documentation/berkeley-db/db/gsg/JAVA/index.html and look for Chap 10.
regards,
Mike Brey, Oracle Berkeley DB -
Your download page for 5.0 stated: All of the App Tabs you have set when you close Firefox will open as App Tabs when you start Firefox again.
I liked the convenience of using App Tabs and was disappointed to find that the ones I had set up yesterday were gone today. Am I doing something wrong?Works fine for me, I can simulate your problem by improperly closing Firefox.
The correct way would be to close the windows you don't want and then to exit Firefox through the File ("'''Alt+F'''") menu then use '''Exit''' or '''Qui'''t depending on your system.
But '''I can simulate your problem''' by closing the good window with "X" in the upper right-corner first (the one with the app-tabs) and then close the other window by any means.
You restart Firefox and open a window, since you closed without app-tabs there are none so you just see a window with your home page.
Firefox has some things added to Firefox 4 and therefore in Firefox 5.
# "'''Alt+S'''" (Hi'''s'''tory menu)
# "'''Restore Previous Session'''" (that's the window without the app-tabs, but you have to this first)
# "'''Restore Recently Closed Windows'''" -- can choose which window to reopen based on name and the mouse-over tells how many tabs. or you just use "'''Restore All Windows'''" without the guessing.
''I know you are on a Mac, and this affects Windows user more than anybody else, but it does affect other systems besides Windows, occasionally, perhaps more often now with the plugins container.''
The following may not completely eliminate having to terminate Firefox through the Windows Control Panel but it will come very close.
'''Plug-in and tasks started by Firefox may continue after attempting
to close Firefox''' The "X" in the upper right-hand corner closes the
Window (same as Ctrl+Shift+W) but even if it is the last Firefox window,
it does not necessarily close Firefox .
The only '''proper way to exit Firefox''' is to use '''Exit''' through the
File menu, not the "X" in the upper right corner of last Firefox window.
In the Firefox 4 and 5 that would be Alt+F then X
* '''Firefox hangs''' | Troubleshooting | Firefox Support <br>http://support.mozilla.com/en-US/kb/Firefox%20hangs#w_hang-at-exit
Use the '''Windows Task Manger''' to remove all running firefox.exe in the "'''Processes'''" tab of the Windows Task Manager, then restart Firefox.
If Firefox will still not start, remove the parent.lock file from the profile which is created each time Firefox is started to prevent other Firefox tasks from running, see<br>
http://kb.mozillazine.org/Profile_in_use#Remove_the_profile_lock_file
'''Avoiding Problems with close/restart''' ''choose either extension''
:Use to close and restart Firefox after enabling or disabling an extension, switching to a new theme, or modifying configuration files, then you don't have to worry about delay or have to look in the Task Manager to see if Firefox is closed yet.
Both extensions use the same keyboard shortcut "'''Ctrl+Alt+R'''" or a file menu option.
*"'''Restartless Restart'''" extension for Firefox 4.0+ only (2 KB download ) <br>https://addons.mozilla.org/firefox/addon/249342/
*For older versions use "'''QuickRestart'''" extension (34 KB download) (<br>https://addons.mozilla.org/firefox/addon/3559/ -
Is the "deadline" variable also set when the Due transition is used ?
Hi,
I needed to understand if the 'deadline' variable is also set when the due transition is used. The reason I am asking is because of the following scenario that we saw:
1. There is a Due transition form an interactive activity to an automatic
2. The automatic had a Syntax error (typo) in a SQL statement
3. When the instance reached this automatic... the instance aborted... [process level Exception level handling is not present :( ]
My first thought was that there was an instanceExpiration exception, but was not certain.
An leads would be nice...1. The exception is seen in the Engine Logs, but the strange thing is that sometimes the Expection is caught within the localized exception block and still manages to bubble up to the process level exception handler...If you have a 'throw ex' in your catch block its supposed to propagate up to the process level... (there is a setting to prevent this...)
2. I tried adding the throws clause in the catch block to force it to always bubble up to the process level exception handle, this does not always happenThis sounds strange, that it doesn't always happen? Right click on the project, and go to Preferences, in the Processes category, set the Exception Handling to 'Propagate', that should send the error the parent process.
3. I tried removing the localized catch blocks to always be caught by the process level handler... this also does not happen consistently... The exception is seen in the engine log and the instance goes on its merry wayIf the exception gets caught, (without an additional 'throw') the instance will continue...
HTH,
-Kevin -
I have an Agilent 34970A DAQ that I am trying to set the NPLC to 10 and keep it set when I issue a temp measurement command to the channels. Right now I can issue the NPLC 10 command to set the channels and it works but when I send the measure channels command the NPLC gets set back to 1. What am I missing to keep this from happening?
Thanks in advance for your help.
CharlesJimmyJin wrote:
Hi Charles,
Was your problem solved? I have run into a very similar situation but instead of HP 34970A, I have a HP 3852A and I want to set NPLC small so that it speeds up the data acqusition.
I tried Measurement and Automation Explorer and use "communicate with Instrument" under GPIB folder and issue the command "NPLC 0" before running labview. But I did not see any change when I run my LabVIEW again. Since this command was working under VEE Pro, I am guessing the setting for NPLC was somehow reset. I am not sure why.
I will try use "GPIB write" vi to see if it does anything but I'm not sure if I should set NPLC value everytime. Please let me know what you think if by any chance you see this message.
Thanks,
Jin
I don't think you can set the NPLC to 0, the minimum value is 0.02. Maybe VEE automatically set it to the minimum value. Instead use NPLC MIN.
Now if you use the MEAS? command to read the value the instrument will use the default value for the type of measurement if you don't specify the resolution (not the integration time, if you look at the 34970A documentation you will see how they relate) which is probably set to NPLC 1.
If you want to speed up things you may look at the ROUT: SCAN and READ? commands to define a scan list.
Ben64 -
Using Mac 0S X Yosemite, in Print Setting when I select layout / arrows select print settings / there is no Basic drop down box to set color management on or off. I'm using Artisan 835 printer.
No - I got the iMac 27 because it was calibrated at the factory(?) and was highly recommended by friends and photographers. No complaints at all, but this printer issue is driving me crazy. I was thinking that if I upgraded to an epson pro printer ICC profile will be on there website. I can't find any for the 835. By the way I didn't calibrate the old dell monitor either and I have had several photos published with no problem at all. Just a note, on epson website there are no printer stating they will run with 10.10 Yosemite. I was looking at the R2000 series. Right now I editing photos that I have to have ready by Jan, maybe by then epson will have something ready.
-
Exception: Cluster address must be set when clustering is enabled
Hi,
I've created a simple web service and deployed to a cluster. When i invoke the WSDL url (http://localhost/webservice/MyService?WSDL) through the browser i get the enclosed exception (listed at the bottom)
I can easily solve this issue by explicitly stating a cluster address witihin the admin console ( Environment->Clusters->Cluster Address:), however the documentation states that i do not need to do this. ( http://edocs.bea.com/wls/docs100/webserv/setenv.html#wp220521 )
Can someone clarify that indeed I need to explicitly declare a Cluster Address when deploying and invoking web services within a clustered environment.
Thanks
#-Exception as displayed within the browser--
Error 500--Internal Server Error
java.lang.IllegalArgumentException: Cluster address must be set when clustering is enabled.
at weblogic.wsee.server.ServerUtil.getClusterAddress(ServerUtil.java:439)
at weblogic.wsee.server.ServerUtil.getHTTPServerURL(ServerUtil.java:130)
at weblogic.wsee.server.servlet.WsdlRequestProcessor.getAddressInfo(WsdlRequestProcessor.java:161)
at weblogic.wsee.server.servlet.WsdlRequestProcessor.process(WsdlRequestProcessor.java:76)
at weblogic.wsee.server.servlet.BaseWSServlet$AuthorizedInvoke.run(BaseWSServlet.java:257)
at weblogic.wsee.server.servlet.BaseWSServlet.service(BaseWSServlet.java:156)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3395)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2140)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2046)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)Hi,
You will have to specify the address for the cluster to get this work. This was done because if cluster address is not specified, there were other issues that popped up.
Its works as designed.
Regards. -
my iPhone 4 is running ios 7.0.4. I have a slightly eccentric back story to all of this; but basically i set a secondary entry passcode on my phone and i have forgotten the secondary passcode; it appears as though i no longer have the opportunity to enter the code after too many failed attempts -- "iphone is disabled, connect to itunes." i have connected to itunes on itunes on both 11.1 and 11.3 versions (my computer says 11.1 is the minimum requirement for my phone to sync) and attempted to restore my phone; THE RESULTING MESSAGE: "The iPhone 'iPhone' could not be restored. This device isn't eligible for the requested build." HOW THE HECK DO I GAIN ENTRY TO MY PHONE AGAIN AND GET SOME USE OUT OF IT. IT DID COST $$$ TO BUY. PLZ HELP!
Hey there Jachin W.,
It sounds like you are unable to connect to your home Wi-Fi suddenly on 2 different iOS devices. I would be interested to know if the affected phones are able to connect to a different Wi-Fi connection, but barring that I would use the following article to help troubleshoot the devices and the Wi-Fi connection:
iOS: Troubleshooting Wi-Fi networks and connections
http://support.apple.com/kb/TS1398
Tap Settings > Wi-Fi and turn Wi-Fi off and on. If your Wi-Fi setting is dimmed, follow these steps.
Restart your iOS device.
Tap Settings > Wi-Fi and locate the Wi-Fi network to which you're connected.
Tap and Forget this Network.
Try to connect to your desired Wi-Fi network.
Note: You may need to enter your Wi-Fi password again if your network requires one.
Turn your Wi-Fi router off and on2. If your ISP also provides cable or phone service, check with them before attempting this step to avoid interruption of service.
Update your device to the latest version of software.
Update your Wi-Fi router to the latest firmware2. For AirPort Base Stations, install updates using the AirPort Utility.
And this section from toward the bottom if needed:
Unable to connect to a Wi-Fi network
Verify that you're attempting to connect to your desired Wi-Fi network.
Make sure you're entering your Wi-Fi password correctly. Passwords may be case sensitive and may contain numbers or special characters.
Reset network settings by tapping Settings > General > Reset > Reset Network Settings. Note: This will reset all network settings including:
previously connected Wi-Fi networks and passwords
recently used Bluetooth accessories
VPN and APN settings
Thank you for using Apple Support Communities.
All the best,
Sterling
Maybe you are looking for
-
How can i display warning messages in user exit EXIT_SAPLMGMU_001 (MM02)
Hi all, while modifying the material master using MM02, i have added new conditions to display messages in user exit EXIT_SPALMGMU_001. But using this user exit i am not able to display warning messages. Can you please help me with this? Sample code
-
How do I sign out of my apple i.d. Using my iPad then sign back n using my other apple I.d? I can't find the option anywhere on my iPad to do this. Anyone know how?
-
I cracked my iPod Touch screen at the top where the front camera is and colored the cracks in with highlighter. I want to know if I can still get it repaired even if its colored in? If I can't, how do I remove the highlighter?
-
Login window only shows one user account
Hi, Anyone has an idea what's happening? I'm running Yosemite on MBPr 15" Mid-2012 When I power on or reboot the laptop, on the login window it only shows one user account, my account which is the Admin account. It doesn't show the secondary normal
-
Migrate Oracle Apps Instance from one server to another
Hi All, We are planning on migrating our Production Oracle Apps Instance(11.5.10.2 and 9.2.0.8) on HP Tru64 UNIX OS on one server to a different server(Node name change) with the same OS. This is a single node, single OS user instance(Apps and DB on