String connectionUrl = "jdbc:cdapexplore://[hostname]:[port]/[database]"; String username = "your_username"; String password = "your_password"; Connection connection = DriverManager.getConnection(connectionUrl, username, password); Properties props = new Properties(); InputStream inputStream = getClass().getClassLoader().getResourceAsStream("config.properties"); props.load(inputStream); String connectionUrl = props.getProperty("connection.url"); String username = props.getProperty("db.username"); String password = props.getProperty("db.password"); Connection connection = DriverManager.getConnection(connectionUrl, username, password); Statement statement = connection.createStatement(); String sqlQuery = "SELECT * FROM your_table"; ResultSet resultSet = statement.executeQuery(sqlQuery); while (resultSet.next()) { }


上一篇:
下一篇:
切换中文