MBO 结果集过滤器 - JDBC 驱动程序
我正在尝试将两个不同的数据源合并到一个 MBO 中。 sybase 文档指出您必须使用 java 开发自定义结果集过滤器。好的。没什么大不了的。我对 JDBC Rowsets 有点熟悉,所以我想我可以处理这个问题。因此,我去获取 JConnect 7 并尝试在结果集过滤器中使用 JDBC 驱动程序来获取结果集,我可以使用该结果集来过滤从我连接到的 Web 服务返回的数据集。我已经通过下面的简单测试测试了我的连接:
try
{
DriverManager.registerDriver((Driver)Class.forName("com.sybase.jdbc4.jdbc.SybDriver").newInstance());
Connection conn = DriverManager.getConnection("jdbc:sybase:Tds:localhost:5500", "dba", "sql");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("Select * from traveler where traveler_id = 1");
while (rs.next())
{
System.out.println(rs.getRow());
}
} catch (Exception se)
{
se.printStackTrace();
}
其中我得到的行计数为一,这正是我所期望的。问题是,当我在 ResultSet 过滤器类中实现相同的代码,并尝试在 MBO 中预览它时,我在 eclipse 调试控制台中收到以下错误(为了清晰起见,进行了蒸馏):
22:14:20 [ERROR] [ExecuteSection]: Execution error
java.lang.reflect.InvocationTargetException...
[...]
Caused by: java.lang.UnsatisfiedLinkError: no dbjodbc11 in java.library.path
这看起来像是一个类路径问题,但我有Jconnect jar 在我的构建路径中,并且我的小测试成功运行这一事实验证了这一点。这是 eclipse 问题吗?在为移动工作区项目执行代码时,eclipse 是否使用不同的类路径?
I am attempting to combine two disparate data sources into one MBO. The sybase documentation states that you have to develop a custom result set filter in java. Ok. No big deal. I am somewhat familiar with JDBC Rowsets so I think I can probably handle this. So I go grab JConnect 7 and am attempting to use the JDBC driver in my result set filter to get a result set that I can use to filter the data set returned from the web service I am connecting to. I have tested my connection with the simple test below:
try
{
DriverManager.registerDriver((Driver)Class.forName("com.sybase.jdbc4.jdbc.SybDriver").newInstance());
Connection conn = DriverManager.getConnection("jdbc:sybase:Tds:localhost:5500", "dba", "sql");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("Select * from traveler where traveler_id = 1");
while (rs.next())
{
System.out.println(rs.getRow());
}
} catch (Exception se)
{
se.printStackTrace();
}
Of which I get a rowcount of one back, which is what I am expecting. The problem is when I implement this same code in the ResultSet filter class, and attempt to preview it in the MBO, I get the following error in the eclipse debug console (distilled for clarity):
22:14:20 [ERROR] [ExecuteSection]: Execution error
java.lang.reflect.InvocationTargetException...
[...]
Caused by: java.lang.UnsatisfiedLinkError: no dbjodbc11 in java.library.path
This looks like a classpath issue, but I have the Jconnect jar in my build path, and that is verified by the fact that my little test runs successfully. Is this an eclipse issue.. is eclipse using a different classpath when executing code for the Mobile workspace project?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前不记得具体路径,但是
/UnwiredWorkspace
文件夹下有一个第三方lib文件夹。尝试在那里添加你的罐子。Can't remember the exact path right now, but there is a third-party lib folder under the
<SybaseInstallation>/UnwiredWorkspace
folder. Try adding your jar there.