Xpages JDBC DB2

2019-09-16 05:44发布

问题:

I´m testing the access to RDBMS through extension library, but there was no sucess. I installed the plugin and the Xpages extension library extended, but when I tested a xpage with combobox that the values are the relational table by the @JdbcDbColumn, the error below display. I´m testing in local in designer not a server.

Error while executing JavaScript computed expression Script interpreter error, line=2, col=8: Error while executing function '@JdbcDbColumn' comp/env/jdbc/db2

Updated info:

I'm using Lotus Notes client version 8.5.3 with UP1 and Extension Library components of relational databases connectivity version 8.5.3.20130315-0724. The content in JDBC file is:

<jdbc> <driver>com.ibm.db2.jcc.DB2Driver</driver>
<url>jdbc:db2://hostname:50000/databasename</url> <user>userdb2</user>     
<password>password</password> </jdbc>

From log.nsf:

HTTP JVM: com.ibm.xsp.webapp.FacesServlet$ExtendedServletException: com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript computed expression 
HTTP JVM: CLFAD0134E: Exception processing XPage request. For more detailed information, please consult error-log-0.xml located in c:/Lotus/Notes8/Data/domino/workspace/logs`

From log error-log-0.xml:

CLFAD0211E: Exception thrown;
CLFAD0246E: Exception occurred servicing request for: /Chapter12.nsf/teste_db2.xsp - HTTP Code: 500;
CLFAD0134E: Exception processing XPage request

I put try/catch and the catch I put printStackTrace():

HTTP JVM: java.sql.SQLException, Caused by:
HTTP JVM: javax.naming.NameNotFoundException: comp/env/jdbc/db2
HTTP JVM: at com.ibm.pvc.jndi.internal.provider.java.FlatMappingContext.lookup(FlatMappingCon‌​text.java:118)
HTTP JVM: at com.ibm.pvc.jndi.internal.provider.java.FlatMappingContext.lookup(FlatMappingCon‌​text.java:140)
HTTP JVM: at javax.naming.InitialContext.lookup(InitialContext.java:436)

Further update: I moved the connection file "db2.jdbc" to WebContent/WEB-INF/JDBC and the driver was found but the error below was displayed:

HTTP JVM: com.ibm.db2.jcc.c.SqlException: [ibm] [db2] [jcc] [10109] [10354] The version of the IBM Universal JDBC driver in use is not is licensed for connectivity to banks QDB2 data. 
HTTP JVM: To connect to this DB2 server, get a licensed version of IBM DB2 Universal Driver for JDBC and SQLJ copy. 
HTTP JVM:. An appropriate license file db2jcc_license _ * jar for this target platform must be installed in the classpath of the application. 
HTTP JVM: Connectivity banks QDB2 data is activated by one of the following license files: [db2jcc_license_cisuz.jar].

Great! Its working! I included the license file db2jcc_license_cisuz.jar in the directory. The integration with DB2 works in values of a combobos, but when I try to use in a view panel the error "HTTP Web Server: Command Not Handled Exception" occurs. What´s wrong? I configured view panel following the instructions of NotesIn9 047 Intro to XPages and Relational Data.

回答1:

Actually, my best guess is that it isn't finding the DB2 JDBC driver, as I take it you mean you are previewing the app in the Notes Client? You should copy the DB2 JDBC driver plugin from C:\<db2-install>\java\db2jcc.jar to C:\<client-install>\jvm\lib\ext\.

Furthermore, you should copy the license file as well, from C:\<db2-install>\java\db2jcc_license.jar to C:\<client-install>\jvm\lib\ext\.

Another suggestion:

It looks like it can't find the jdbc connection file. The file should be namesd db2.jdbc in your application, and it should be located in the WebContent\WEB-INF\jdbc folder

Similar previous questions:

JDBC installed, but getting error trying to connect to Oracle

JDBC Ordeal: it shouldn't be that difficult (Partial Solved, New Errors)

OpenNTF question