<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>评论：有朋自远方来！</title>
	<atom:link href="http://www.bdbchina.com/2009/01/welcome/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bdbchina.com/2009/01/welcome/</link>
	<description>Oracle Berkeley DB 中国研发团队的博客</description>
	<lastBuildDate>Mon, 19 Jul 2010 03:43:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>来自：Emily Fu</title>
		<link>http://www.bdbchina.com/2009/01/welcome/comment-page-1/#comment-1227</link>
		<dc:creator>Emily Fu</dc:creator>
		<pubDate>Tue, 29 Jun 2010 06:26:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=1#comment-1227</guid>
		<description>你可以到google上搜索跟你服务器平台相关的库链接函数，例如在linux平台，查看当前应用程序链接的库名和地址是ldd。

根据你的错误信息，可能的问题有：
1. 错误编译BDB库
2. 错误链接库
3. 错误链接头文件

如果你依然没有找到问题，建议调试一下，打印你的运行栈，看看链接的库是什么，另外进入set_lk_priority时，查看传入了什么参数。具体方法，请根据你所在的平台在google找到相应的方法。</description>
		<content:encoded><![CDATA[<p>你可以到google上搜索跟你服务器平台相关的库链接函数，例如在linux平台，查看当前应用程序链接的库名和地址是ldd。</p>
<p>根据你的错误信息，可能的问题有：<br />
1. 错误编译BDB库<br />
2. 错误链接库<br />
3. 错误链接头文件</p>
<p>如果你依然没有找到问题，建议调试一下，打印你的运行栈，看看链接的库是什么，另外进入set_lk_priority时，查看传入了什么参数。具体方法，请根据你所在的平台在google找到相应的方法。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：polarbear</title>
		<link>http://www.bdbchina.com/2009/01/welcome/comment-page-1/#comment-1224</link>
		<dc:creator>polarbear</dc:creator>
		<pubDate>Mon, 28 Jun 2010 13:50:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=1#comment-1224</guid>
		<description>&lt;a href=&quot;#comment-1217&quot; rel=&quot;nofollow&quot;&gt;@polarbear &lt;/a&gt; 
您好：
     老师，我的问题被忽略了吗，麻烦老师抽时间解答下吧。。
谢谢老师了。。</description>
		<content:encoded><![CDATA[<p><a href="#comment-1217" rel="nofollow">@polarbear </a><br />
您好：<br />
     老师，我的问题被忽略了吗，麻烦老师抽时间解答下吧。。<br />
谢谢老师了。。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：polarbear</title>
		<link>http://www.bdbchina.com/2009/01/welcome/comment-page-1/#comment-1219</link>
		<dc:creator>polarbear</dc:creator>
		<pubDate>Fri, 25 Jun 2010 11:30:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=1#comment-1219</guid>
		<description>&lt;a href=&quot;#comment-1209&quot; rel=&quot;nofollow&quot;&gt;@Emily Fu &lt;/a&gt; 
您好：
     老师。
请问如何检测服务器上是否存在其他版本的BDB库？（我没有安装过，但是我想知道怎么判断）
怎么判断我include的头文件跟我的dll是否一致啊？
另外，如果不是你上面的原因，还有可能是什么原因呢？
麻烦老师点播一下。。</description>
		<content:encoded><![CDATA[<p><a href="#comment-1209" rel="nofollow">@Emily Fu </a><br />
您好：<br />
     老师。<br />
请问如何检测服务器上是否存在其他版本的BDB库？（我没有安装过，但是我想知道怎么判断）<br />
怎么判断我include的头文件跟我的dll是否一致啊？<br />
另外，如果不是你上面的原因，还有可能是什么原因呢？<br />
麻烦老师点播一下。。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：polarbear</title>
		<link>http://www.bdbchina.com/2009/01/welcome/comment-page-1/#comment-1218</link>
		<dc:creator>polarbear</dc:creator>
		<pubDate>Fri, 25 Jun 2010 11:26:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=1#comment-1218</guid>
		<description>&lt;a href=&quot;#comment-882&quot; rel=&quot;nofollow&quot;&gt;@windsay &lt;/a&gt; 
您好：
    老师。
我用下面的命令可以编译通过
g++ BDB_test.cpp -I/usr/local/BerkeleyDB.5.0/include -L/usr/local/BerkeleyDB.5.0/lib -ldb_cxx
但是为什么运行的时候提示：
“打开数据库出错:DbEnv::set_lk_priority: Invalid argument
段错误”
呢？
我之前在自己机器上编译运行都没有问题，但是我到服务器上按照和之前完全相同的办法安装，而且运行完全相同的测试程序，为什么就会出现这个问题呢？
我在网上查了很多资料，但是都没能解决，希望老师可以尽快解答一下，非常感谢！！</description>
		<content:encoded><![CDATA[<p><a href="#comment-882" rel="nofollow">@windsay </a><br />
您好：<br />
    老师。<br />
我用下面的命令可以编译通过<br />
g++ BDB_test.cpp -I/usr/local/BerkeleyDB.5.0/include -L/usr/local/BerkeleyDB.5.0/lib -ldb_cxx<br />
但是为什么运行的时候提示：<br />
“打开数据库出错:DbEnv::set_lk_priority: Invalid argument<br />
段错误”<br />
呢？<br />
我之前在自己机器上编译运行都没有问题，但是我到服务器上按照和之前完全相同的办法安装，而且运行完全相同的测试程序，为什么就会出现这个问题呢？<br />
我在网上查了很多资料，但是都没能解决，希望老师可以尽快解答一下，非常感谢！！</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：polarbear</title>
		<link>http://www.bdbchina.com/2009/01/welcome/comment-page-1/#comment-1217</link>
		<dc:creator>polarbear</dc:creator>
		<pubDate>Fri, 25 Jun 2010 11:25:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=1#comment-1217</guid>
		<description>&lt;a href=&quot;#comment-895&quot; rel=&quot;nofollow&quot;&gt;@winterzhang &lt;/a&gt; 
您好：
    老师。
我用下面的命令可以编译通过
g++ BDB_test.cpp -I/usr/local/BerkeleyDB.5.0/include -L/usr/local/BerkeleyDB.5.0/lib -ldb_cxx
但是为什么运行的时候提示：
“打开数据库出错:DbEnv::set_lk_priority: Invalid argument
段错误”
呢？
我之前在自己机器上编译运行都没有问题，但是我到服务器上按照和之前完全相同的办法安装，而且运行完全相同的测试程序，为什么就会出现这个问题呢？
我在网上查了很多资料，但是都没能解决，希望老师可以尽快解答一下，非常感谢！！</description>
		<content:encoded><![CDATA[<p><a href="#comment-895" rel="nofollow">@winterzhang </a><br />
您好：<br />
    老师。<br />
我用下面的命令可以编译通过<br />
g++ BDB_test.cpp -I/usr/local/BerkeleyDB.5.0/include -L/usr/local/BerkeleyDB.5.0/lib -ldb_cxx<br />
但是为什么运行的时候提示：<br />
“打开数据库出错:DbEnv::set_lk_priority: Invalid argument<br />
段错误”<br />
呢？<br />
我之前在自己机器上编译运行都没有问题，但是我到服务器上按照和之前完全相同的办法安装，而且运行完全相同的测试程序，为什么就会出现这个问题呢？<br />
我在网上查了很多资料，但是都没能解决，希望老师可以尽快解答一下，非常感谢！！</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：Emily Fu</title>
		<link>http://www.bdbchina.com/2009/01/welcome/comment-page-1/#comment-1213</link>
		<dc:creator>Emily Fu</dc:creator>
		<pubDate>Thu, 24 Jun 2010 09:27:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=1#comment-1213</guid>
		<description>你好，请问你服务器上是否存在其他版本的BDB库，你include的头文件跟你的dll是否一致？</description>
		<content:encoded><![CDATA[<p>你好，请问你服务器上是否存在其他版本的BDB库，你include的头文件跟你的dll是否一致？</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：polarbear</title>
		<link>http://www.bdbchina.com/2009/01/welcome/comment-page-1/#comment-1210</link>
		<dc:creator>polarbear</dc:creator>
		<pubDate>Wed, 23 Jun 2010 11:25:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=1#comment-1210</guid>
		<description>&lt;a href=&quot;#comment-1209&quot; rel=&quot;nofollow&quot;&gt;@Emily Fu &lt;/a&gt; 
您好：
EmilyFu老师
我按照你的要求，重新编译了服务器上的BDB库，但是仍然出现相同的问题。
但是我在自己的机器上用完全相同的方法操作，就没有错误啊，这个问题我在网上查找不到答案啊。碰到这个问题的人比较少啊。
下面是我的程序。


#include
#include
#include
using namespace std;
DbEnv* g_env = NULL;
Db *g_db = NULL;
void closeEnv()
{
	try
	{
		if(g_db)
		{
			g_db-&gt;close(0);
			delete g_db;
			g_db = NULL;
		}
		if(g_env)
		{
			g_env-&gt;close(0);
			delete g_env;
			g_env = NULL;
		}
	}
	catch(DbException &amp;e)
	{
		cout&lt;&lt;&quot;&quot;&lt;&lt;e.what()&lt;set_error_stream(&amp;std::cerr);
		g_env-&gt;set_cachesize(0,10*1024*1024,1);
		g_env-&gt;open(strEnvHome.c_str(),nEnvFlags,0);
		
		g_db=new Db(g_env,0);
		g_db-&gt;set_error_stream(&amp;std::cerr);
		
		g_db-&gt;open(NULL,strDbFileName.c_str(),NULL,DB_BTREE,DB_CREATE,0);
		
	}
	catch(DbException &amp;e)
	{
		cout&lt;&lt;&quot;打开数据库出错:&quot;&lt;&lt;e.what()&lt;&lt;endl;
		closeEnv();
		return -1;
	}
	Dbt key,data;
	char sKey[1024],sData[1024];

	try
	{
		for(int i=0;iput(NULL,&amp;key,&amp;data,0)!=0)
			{
				cout&lt;&lt;&quot;插入第&quot;&lt;&lt;i&lt;&lt;&quot;个数据时出错&quot;&lt;&lt;endl;
			}
			
		}
	}
	catch(DbException &amp;e)
	{
		cout&lt;&lt;&quot;写入数据库出错:&quot;&lt;&lt;e.what()&lt;sync(0);
	try
	{
		snprintf(sKey,sizeof(sKey),&quot;key%d&quot;,7);
		key.set_data(sKey);
		key.set_size(strlen(sKey));
		if(g_db-&gt;get(NULL,&amp;key,&amp;data,0)!=0)
		{
			cout&lt;&lt;&quot;未查找到,key:&quot;&lt;&lt;sKey&lt;&lt;endl;
		}
		else
		{
			memcpy(sData,data.get_data(),data.get_size());
			sData[data.get_size()]=&#039;&#039;;
			cout&lt;&lt;&quot;查找到:&quot;&lt;&lt;endl&lt;&lt;&quot;key:&quot;&lt;&lt;sKey&lt;&lt;&quot;;\tdata:&quot;&lt;&lt;sData&lt;&lt;endl&lt;&lt;endl;
		}
	}
	catch(DbException &amp;e)
	{
		cout&lt;&lt;&quot;查找数据库出错:&quot;&lt;&lt;e.what()&lt;cursor(NULL,&amp;cursorp,0)!=0)
		{
			cout&lt;&lt;&quot;[get cursor error.&quot;&lt;get(&amp;key,&amp;data,DB_NEXT)==0)
			{
				memcpy(sKey,key.get_data(),key.get_size());
				sKey[key.get_size()]=&#039;&#039;;
				memcpy(sData,data.get_data(),data.get_size());
				sData[data.get_size()]=&#039;&#039;;
				cout&lt;&lt;&quot;key:&quot;&lt;&lt;sKey&lt;&lt;&quot;;\tdata:&quot;&lt;&lt;sData&lt;&lt;endl&lt;&lt;endl;
			}
		}
	}
	catch(DbException &amp;e)
	{
		cout&lt;&lt;&quot;用游标遍历出错:&quot;&lt;&lt;e.what()&lt;&lt;endl;
		closeEnv();
		return -1;
	}
	closeEnv();

	return 0;
}



下面是我的makefile文件。

BDB_test:BDB_test.o
	g++ BDB_test.o -I/usr/local/BerkeleyDB.5.0/include -o BDB_test
BDB_test.o:BDB_test.cpp
	g++ -c BDB_test.cpp 
clean:
	rm *.o BDB_test


因为我在自己的机器上可以成功运行，所以估计问题出现在别的地方，不是我安装的问题，链接库也没有问题，那请问，最有可能是哪里的问题呢？
因为您的经验比较丰富，麻烦指点一下吧。。我也再想想其他方法。。。
期待您的回复！！</description>
		<content:encoded><![CDATA[<p><a href="#comment-1209" rel="nofollow">@Emily Fu </a><br />
您好：<br />
EmilyFu老师<br />
我按照你的要求，重新编译了服务器上的BDB库，但是仍然出现相同的问题。<br />
但是我在自己的机器上用完全相同的方法操作，就没有错误啊，这个问题我在网上查找不到答案啊。碰到这个问题的人比较少啊。<br />
下面是我的程序。</p>
<p>#include<br />
#include<br />
#include<br />
using namespace std;<br />
DbEnv* g_env = NULL;<br />
Db *g_db = NULL;<br />
void closeEnv()<br />
{<br />
	try<br />
	{<br />
		if(g_db)<br />
		{<br />
			g_db-&gt;close(0);<br />
			delete g_db;<br />
			g_db = NULL;<br />
		}<br />
		if(g_env)<br />
		{<br />
			g_env-&gt;close(0);<br />
			delete g_env;<br />
			g_env = NULL;<br />
		}<br />
	}<br />
	catch(DbException &amp;e)<br />
	{<br />
		cout&lt;&lt;&quot;&quot;&lt;&lt;e.what()&lt;set_error_stream(&amp;std::cerr);<br />
		g_env-&gt;set_cachesize(0,10*1024*1024,1);<br />
		g_env-&gt;open(strEnvHome.c_str(),nEnvFlags,0);</p>
<p>		g_db=new Db(g_env,0);<br />
		g_db-&gt;set_error_stream(&amp;std::cerr);</p>
<p>		g_db-&gt;open(NULL,strDbFileName.c_str(),NULL,DB_BTREE,DB_CREATE,0);</p>
<p>	}<br />
	catch(DbException &amp;e)<br />
	{<br />
		cout&lt;&lt;&quot;打开数据库出错:&quot;&lt;&lt;e.what()&lt;&lt;endl;<br />
		closeEnv();<br />
		return -1;<br />
	}<br />
	Dbt key,data;<br />
	char sKey[1024],sData[1024];</p>
<p>	try<br />
	{<br />
		for(int i=0;iput(NULL,&amp;key,&amp;data,0)!=0)<br />
			{<br />
				cout&lt;&lt;&quot;插入第&quot;&lt;&lt;i&lt;&lt;&quot;个数据时出错&quot;&lt;&lt;endl;<br />
			}</p>
<p>		}<br />
	}<br />
	catch(DbException &amp;e)<br />
	{<br />
		cout&lt;&lt;&quot;写入数据库出错:&quot;&lt;&lt;e.what()&lt;sync(0);<br />
	try<br />
	{<br />
		snprintf(sKey,sizeof(sKey),&#8221;key%d&#8221;,7);<br />
		key.set_data(sKey);<br />
		key.set_size(strlen(sKey));<br />
		if(g_db-&gt;get(NULL,&amp;key,&amp;data,0)!=0)<br />
		{<br />
			cout&lt;&lt;&quot;未查找到,key:&quot;&lt;&lt;sKey&lt;&lt;endl;<br />
		}<br />
		else<br />
		{<br />
			memcpy(sData,data.get_data(),data.get_size());<br />
			sData[data.get_size()]=&#039;&#039;;<br />
			cout&lt;&lt;&quot;查找到:&quot;&lt;&lt;endl&lt;&lt;&quot;key:&quot;&lt;&lt;sKey&lt;&lt;&quot;;\tdata:&quot;&lt;&lt;sData&lt;&lt;endl&lt;&lt;endl;<br />
		}<br />
	}<br />
	catch(DbException &amp;e)<br />
	{<br />
		cout&lt;&lt;&quot;查找数据库出错:&quot;&lt;&lt;e.what()&lt;cursor(NULL,&amp;cursorp,0)!=0)<br />
		{<br />
			cout&lt;&lt;&quot;[get cursor error.&quot;&lt;get(&amp;key,&amp;data,DB_NEXT)==0)<br />
			{<br />
				memcpy(sKey,key.get_data(),key.get_size());<br />
				sKey[key.get_size()]=&#8221;;<br />
				memcpy(sData,data.get_data(),data.get_size());<br />
				sData[data.get_size()]=&#8221;;<br />
				cout&lt;&lt;&quot;key:&quot;&lt;&lt;sKey&lt;&lt;&quot;;\tdata:&quot;&lt;&lt;sData&lt;&lt;endl&lt;&lt;endl;<br />
			}<br />
		}<br />
	}<br />
	catch(DbException &amp;e)<br />
	{<br />
		cout&lt;&lt;&quot;用游标遍历出错:&quot;&lt;&lt;e.what()&lt;&lt;endl;<br />
		closeEnv();<br />
		return -1;<br />
	}<br />
	closeEnv();</p>
<p>	return 0;<br />
}</p>
<p>下面是我的makefile文件。</p>
<p>BDB_test:BDB_test.o<br />
	g++ BDB_test.o -I/usr/local/BerkeleyDB.5.0/include -o BDB_test<br />
BDB_test.o:BDB_test.cpp<br />
	g++ -c BDB_test.cpp<br />
clean:<br />
	rm *.o BDB_test</p>
<p>因为我在自己的机器上可以成功运行，所以估计问题出现在别的地方，不是我安装的问题，链接库也没有问题，那请问，最有可能是哪里的问题呢？<br />
因为您的经验比较丰富，麻烦指点一下吧。。我也再想想其他方法。。。<br />
期待您的回复！！</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：Emily Fu</title>
		<link>http://www.bdbchina.com/2009/01/welcome/comment-page-1/#comment-1209</link>
		<dc:creator>Emily Fu</dc:creator>
		<pubDate>Tue, 22 Jun 2010 11:13:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=1#comment-1209</guid>
		<description>&lt;a href=&quot;#comment-1182&quot; rel=&quot;nofollow&quot;&gt;@polarbear &lt;/a&gt; 

你好，请重新编译你在服务器上的BDB库，并检查链接的库是否正确。</description>
		<content:encoded><![CDATA[<p><a href="#comment-1182" rel="nofollow">@polarbear </a> </p>
<p>你好，请重新编译你在服务器上的BDB库，并检查链接的库是否正确。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：chaohuang</title>
		<link>http://www.bdbchina.com/2009/01/welcome/comment-page-1/#comment-1208</link>
		<dc:creator>chaohuang</dc:creator>
		<pubDate>Tue, 22 Jun 2010 11:08:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=1#comment-1208</guid>
		<description>&lt;a href=&quot;#comment-1207&quot; rel=&quot;nofollow&quot;&gt;@polarbear &lt;/a&gt; 
稍后会有我们的工程师回复你的问题。下次请记得将问题发到BDB 5.0相关的博客。谢谢。</description>
		<content:encoded><![CDATA[<p><a href="#comment-1207" rel="nofollow">@polarbear </a><br />
稍后会有我们的工程师回复你的问题。下次请记得将问题发到BDB 5.0相关的博客。谢谢。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：polarbear</title>
		<link>http://www.bdbchina.com/2009/01/welcome/comment-page-1/#comment-1207</link>
		<dc:creator>polarbear</dc:creator>
		<pubDate>Tue, 22 Jun 2010 07:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.bdbchina.com/?p=1#comment-1207</guid>
		<description>您好，上一个帖子是我发的，已经发出了十天左右了，怎么还不见解决呢，是不是我的帖子被忽略了啊，再发一个，麻烦老师尽快给解决以下。。先谢谢了。</description>
		<content:encoded><![CDATA[<p>您好，上一个帖子是我发的，已经发出了十天左右了，怎么还不见解决呢，是不是我的帖子被忽略了啊，再发一个，麻烦老师尽快给解决以下。。先谢谢了。</p>
]]></content:encoded>
	</item>
</channel>
</rss>
Դ