IDEA连接人大金仓数据库

java 复制代码
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class KingbaseConnection {
    public static void main(String[] args) {
        String url = "jdbc:kingbase8://localhost:54321/mydatabase";
        String user = "username";
        String password = "password";

        try {
            Connection connection = DriverManager.getConnection(url, user, password);
            System.out.println("Connected to the database!");
            connection.close();
        } catch (SQLException e) {
            System.out.println("Failed to connect to the database.");
            e.printStackTrace();
        }
    }
}

连接成功:

相关推荐
huazhixuthink4 分钟前
PostgreSQL三种关闭方式的区别
数据库·postgresql
失散138 分钟前
并发编程——17 CPU缓存架构详解&高性能内存队列Disruptor实战
java·缓存·架构·并发编程
only-qi4 小时前
146. LRU 缓存
java·算法·缓存
阿里小阿希5 小时前
Vue3 + Element Plus 项目中日期时间处理的最佳实践与数据库设计规范
数据库·设计规范
xuxie136 小时前
SpringBoot文件下载(多文件以zip形式,单文件格式不变)
java·spring boot·后端
白鹭6 小时前
MySQL源码部署(rhel7)
数据库·mysql
重生成为编程大王6 小时前
Java中的多态有什么用?
java·后端
666和7776 小时前
Struts2 工作总结
java·数据库
还听珊瑚海吗6 小时前
SpringMVC(一)
数据库
中草药z6 小时前
【Stream API】高效简化集合处理
java·前端·javascript·stream·parallelstream·并行流