import java.sql.*; public class DuckDBExample { public static void main(String[] args) { Connection connection = null; Statement statement = null; ResultSet resultSet = null; try { connection = DriverManager.getConnection("jdbc:duckdb://localhost:50000/database"); statement = connection.createStatement(); resultSet = statement.executeQuery("SELECT * FROM table"); while (resultSet.next()) { System.out.println(resultSet.getString(1)); } } catch (SQLException e) { e.printStackTrace(); } finally { try { if (resultSet != null) { resultSet.close(); } if (statement != null) { statement.close(); } if (connection != null) { connection.close(); } } catch (SQLException e) { e.printStackTrace(); } } } }


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