我使用以下命令
在PCF中为db2创建了一个用户提供的服务cf cups db2-service -p "jdbcUrl,user,password"
并将服务绑定到应用程序,并可以在VCAP服务中查看环境变量
"VCAP_SERVICES": {
"user-provided": [
{
"credentials": {
"jdbcUrl": "jdbc:db2://xxx.yyy.com:446/zzz",
"password": "aaaaa",
"user": "bbbbb"
},
"label": "user-provided",
"name": "db2-service",
"syslog_drain_url": "",
"tags": [],
"volume_mounts": []
}
]
}
}
当推送应用程序时,我收到错误“无法支持空用户ID”,我尝试将用户参数更改为用户ID /用户名,但它仍然给我同样的错误,请指出服务参数是否正确提供。
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][t4][10205][11234][4.13.80] Null userid is not supported. ERRORCODE=-4461, SQLSTATE=42815
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80) ~[spring-jdbc-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:326) ~[spring-jdbc-4.3.14.RELEASE.jar!/:4.3.14.RELEASE]
Caused by: com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][t4][10205][11234][4.13.80] Null userid is not supported. ERRORCODE=-4461, SQLSTATE=42815
at com.ibm.db2.jcc.am.id.a(id.java:677) ~[db2jcc4.jar!/:na]