问题描述
好的,我让我们的一个JAVA/JDBC专家来看了http://stackoverflow.com/questions/9787525/jdbc-ordeal-it-shouldnt-be-that-difficult-partial-solved-new-errors
中记录的JDBC问题.看来,如果我将ojdbc14用作ConnectionName,则会出现此错误:
Ok, I got one of our JAVA/JDBC guys to come take a look at my JDBC issue as documented in http://stackoverflow.com/questions/9787525/jdbc-ordeal-it-shouldnt-be-that-difficult-partial-solved-new-errors
It seems that if I put ojdbc14 as the ConnectionName I get this error:
Error while reading the relational data
Error while loading connection ojdbc14
Error parsing XML stream
InputStream cannot be null
但是,如果我将ojdbc14.jdbc作为ConnectionName,则会出现此错误:
But if I put ojdbc14.jdbc as the ConnectionName I get this error:
Error while reading the relational data
comp/env/jdbc/ojdbc14.jdbc
他似乎认为应该使用第二个版本,但是服务器上缺少一些配置,例如JNDI名称或类似名称.
He seems to think that the second version is the one that should be used, but that there is some missing configuration on the server, like JNDI name or something like that.
我需要某人确认其中的一种或另一种是正确的格式,以及服务器端要查找连接信息所必须进行的确切操作.
I need someone to confirm that one or the other of these is the correct format and what exactly has to be done of the server side for it to find the connection information.
任何帮助将不胜感激.
MJ
推荐答案
See http://www.openntf.org/internal/home.nsf/response.xsp?action=openDocument&documentId=7888655D70FDDD6186257930002E1D3F&MainID=D861DE698262EDDA86257930002AEE52 for an example how to connect to MS SQL. It might give you some ideas, since JDBC is more or less the same for any RDBMS. See specifically point 1. It's not enough to put the .jar to plugins folder. It needs to be as plugin.
请参见 http://www-10.lotus.com/ldd /ddwiki.nsf/dx/creating_an_xpages_library 获取有关如何创建插件的说明.
See http://www-10.lotus.com/ldd/ddwiki.nsf/dx/creating_an_xpages_library for instructions how to create a plugin.
更新我确实使用H2数据库引擎从头开始尝试.以下作品:
UpdateI did try it from scratch with H2 database engine. Following works:
1)我将JDBC驱动程序导入到WebContent/WEB-INF/lib
1) I imported JDBC driver to WebContent/WEB-INF/lib
2)我确实使用以下内容创建了WebContent/WEB-INF/jdbc/h2.jdbc
2) I did create WebContent/WEB-INF/jdbc/h2.jdbc with following content
<jdbc>
<driver>org.h2.Driver</driver>
<url>jdbc:h2:tcp://localhost/~/test</url>
<user>SA</user>
<password></password>
</jdbc>
3)创建一个包含以下内容的简单Xpage.我在用粗体标记的地方指定了(2)中定义的连接.
3) Create a simple Xpage with following content. I marked with bold part where connection defined in (2) is specified.
<xp:viewPanel rows="10" id="viewPanel1" var="user">
<xp:this.facets>
<xp:pager partialRefresh="true" layout="Previous Group Next"
xp:key="headerPager" id="pager1">
</xp:pager>
</xp:this.facets>
<xp:this.data>
<xe:jdbcQuery connectionName="h2" sqlQuery="select * from test"
var="jdbcData1" defaultOrderBy="id">
</xe:jdbcQuery>
</xp:this.data>
<xp:viewColumn id="viewColumn1" columnName="id">
<xp:this.facets>
<xp:viewColumnHeader xp:key="header" id="viewColumnHeader1"
value="ID" sortable="true">
</xp:viewColumnHeader>
</xp:this.facets>
</xp:viewColumn>
<xp:viewColumn id="viewColumn2" columnName="name">
<xp:this.facets>
<xp:viewColumnHeader xp:key="header" id="viewColumnHeader2"
value="NAME" sortable="true">
</xp:viewColumnHeader>
</xp:this.facets>
</xp:viewColumn>
</xp:viewPanel>
稍后将尝试在Oracle 11g Express Edition中重现它.
Will try reproduce it later in Oracle 11g Express Edition.
更新#2
对于Oracle 11 XE第2版,其工作原理完全相同,只有一个例外.我必须遵循 http://www-01.ibm.com/support /docview.wss?uid=swg21279509 授予以下权利:
For Oracle 11 XE Release 2 it works exactly the same, with only one exception. I had to follow http://www-01.ibm.com/support/docview.wss?uid=swg21279509 to grant following rights:
grant {
permission java.lang.RuntimePermission "getClassLoader";
}
此外,由于Domino 8.5.3使用Java 6,因此我按照Oracle文档中的建议使用了ojdbc6.jar.当然,我最初的声明是将Oracle JDBC驱动程序以插件的形式添加到Domino中,因为将允许您在每个XPages应用程序中使用它.
In addition, I used ojdbc6.jar as advised in Oracle documentation, due to fact that Domino 8.5.3 uses Java 6. Of course, my initial statement with adding Oracle JDBC driver to Domino in form of a plugin, since this will allow you to use it in every XPages application.
这篇关于对于XPages中的JDBC,服务器如何知道连接信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!