用Java写个拆分数据库连接URL
时间: 2023-03-16 18:44:11 浏览: 69
我可以给你提供一个示例代码来帮助你拆分数据库连接URL:String url = "jdbc:mysql://localhost:3306/test";
String[] urlParts = url.split(":");
String dbUrl = urlParts[0];
String host = urlParts[1];
String[] hostParts = host.split("/");
String hostAddress = hostParts[0];
String dbName = hostParts[1];
相关推荐
![xmind](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![dll](https://img-home.csdnimg.cn/images/20210720083646.png)
![md](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)