jdbc.driver=io.herd.db.jdbc.Driver jdbc.url=jdbc:herddb:local:localhost jdbc.username=username jdbc.password=password import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class HerdDBExample { public static void main(String[] args) { Connection connection = null; try { Class.forName("io.herd.db.jdbc.Driver"); String url = "jdbc:herddb:local:localhost"; String username = "username"; String password = "password"; connection = DriverManager.getConnection(url, username, password); e.printStackTrace(); } finally { if (connection != null) { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } } } } } import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class HerdDBExample { public static void main(String[] args) { Connection connection = null; try { Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery("SELECT * FROM table_name"); while (resultSet.next()) { } resultSet.close(); statement.close(); } catch (SQLException e) { e.printStackTrace(); } finally { } } }


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