一个连接到PostgreSQL并从默认数据库postgres
打印出所有表的JDBC示例
pom.xml
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.5</version>
</dependency>
</dependencies>
PS已通过Java 8和postgresql jdbc驱动程序42.2.5测试
PrintAllTables.java
package com.mkyong.jdbc;
import java.sql.*;
public class PrintAllTables {
public static void main(String[] argv) {
System.out.println("PostgreSQL JDBC Connection Testing ~");
try {
Class.forName(