您是否在 Websphere Application Server 中创建了 jdbc 连接?WAR 文件中的应用程序需要它来连接到数据库。
如果你已经完成了,你可以检查你的 WAR 文件并在 WEB-INF/ 文件夹中查找 web.xml 文件。就我而言,我在文件中发现了一个硬编码的 jdbc,例如:
<resource-ref>
<description>Worklight Server Database</description>
<res-ref-name>jdbc/WorklightDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>Reports Database</description>
<res-ref-name>jdbc/WorklightReportsDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
您可以将这些硬编码文件重命名为与您在 WAS 中创建的 jdbc 相同的名称。
对于数据库问题,您可以按照此链接使用 ant 进行数据库创建。
http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/index.jsp?topic=/com.ibm.worklight.deploy.doc/devref/r_ant_tasks_configure_dbs.html
如果您按照第一个 ant 脚本进行 DB2 创建,它将有两个不同的数据库,如果您还没有这样做,您需要为此行创建新用户。因为如您所见,在 xml 脚本中,创建 WRKLGHT 数据库需要用户名和密码。例如:
<db2 database="WRKLGHT" server="proddb.example.com"
user="wl6admin" password="wl6pass">
如果您为 DB2 连接使用非默认端口,您可以在服务器参数之后添加端口号参数。例如:
端口="50001"
对于用户创建,你可以点击这个链接:
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=%2Fcom.ibm.db2.luw.qb.server.doc%2Fdoc%2Ft0006742.html