Here you can find the source of formatSQLForColumnName(Connection conn, String strSQL)
public static String formatSQLForColumnName(Connection conn, String strSQL) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.*; public class Main { private static String myclass = "CommonDB"; public static String formatSQLForColumnName(Connection conn, String strSQL) throws SQLException { String method = "formatSQLForColumnName"; int location = 1000; try {/*from ww w . ja v a 2 s .c o m*/ location = 2000; Statement stmt = conn.createStatement(); location = 2100; ResultSet rs = stmt.executeQuery(strSQL); location = 2200; String columnSQL = ""; location = 2300; while (rs.next()) { location = 3000; //Create the list of columns for a SQL statement below if (columnSQL == "") { columnSQL = rs.getString(1); } else { columnSQL = columnSQL + ", " + rs.getString(1); } } location = 3500; return columnSQL; } catch (SQLException ex) { throw new SQLException("(" + myclass + ":" + method + ":" + location + ":" + ex.getMessage() + ")"); } } }