Created
November 28, 2014 08:02
-
-
Save wyukawa/ebb270ff8d484bbe3903 to your computer and use it in GitHub Desktop.
posgresql jdbc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.sql.Connection; | |
| import java.sql.DatabaseMetaData; | |
| import java.sql.Driver; | |
| import java.sql.DriverManager; | |
| import java.util.Properties; | |
| public class Main { | |
| public static void main(String[] args) throws Throwable { | |
| Driver driver = (Driver)Class.forName("org.postgresql.Driver").newInstance(); | |
| Properties prop = new Properties(); | |
| prop.setProperty("protocolVersion", "2"); | |
| prop.setProperty("user", "postgres"); | |
| Connection conn = driver.connect("jdbc:postgresql://localhost:9990/hive", prop); | |
| conn.setAutoCommit(false); | |
| DatabaseMetaData metaData = conn.getMetaData(); | |
| int maxColumnNameLength = metaData.getMaxColumnNameLength(); | |
| System.out.println(maxColumnNameLength); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment