jdbc: Get the SQL Type Name from java.sql.Type code

前端 未结 8 1026
情歌与酒
情歌与酒 2021-02-01 14:56

I have an array with Field Names and jdbc Type codes. (Those int codes that you can find in

http://download.oracle.com/javase/1.4.2/docs/api/constant-values.html#java.s

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-01 15:58

    You need the ResultSetMetaData object of your current ResultSet. You can get it with getMetaData(). Iterate over the columns and call foreach column the method

    1. getColumnType(i)
    2. getColumnClassName(i)
    3. getColumnTypeName(i)

    of your ResultSetMetaData.

    i represents the column number (starting by 1).

提交回复
热议问题