postgresql - If a data type is numeric in database how to check it's precision and scale using java -
I can verify the name of the column using this code
connection jdbcConnection = DriverManager .getConnection ("JDBC: PostgreSQL: // localhost: 9823 / postgres", "postgres", "password"); Database Sitadata md = jdbcConnection.getMetaData (); Results set rs = md.getColumn ("Postgres", blank, "my_table", "%"); While (rsnext ()) {System.out.println (rs.getString (4)); } How to check the accuracy and scale of a numerical datatype in any column?
You can get column meta data through Once you receive the ResultSetMetaData . You can get meta data as follows:
ResultSet rset = st.executeQuery ("blah"); Resultsetmetadata md = rset.getMetaData (); ResultSetMetaData , call the following to get the exact and scale:
Int getprision (int column) int GetScale (int column)
Comments
Post a Comment