我有一个春季启动应用程序,我试图连接到DB2服务。但是我得到了No service connection creator exception,因为关键的云铸造厂支持Mongo数据库和其他一些数据库。有人可以告诉我如何在春季编写自定义服务连接器DB2服务的启动应用程序?
Create the DB2 service as a user-provided service using the command line:
cf cups db2-service -p "uri,user,password"
You will be prompted for the parameters. Enter user, password, and URI:
jdbc:db2://<host>[:<port>]/<database_name>
Make sure you have Cloud Connectors declared in your pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cloud-connectors</artifactId>
</dependency>
Bind the service to your app. Now you can access the database through declarations like:
@Autowired
JdbcTemplate _jdbcTemplate;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.