Respected Sir/Madam,
 We are implementing Apache Metamodel for getting Excel Sheet Data to Postgresql Table . I am enclosing here with the code we have written for the above and the output we got after running the class file on console using Eclipse Oxygen

Please see the attached file and give us sample code for inserting the data to postgresql table. Your earliest reponse in this regard will be most helpful for us.

Thanking you in advance,

With regards,

Gowri S import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Arrays;

import org.apache.metamodel.MetaModelException;
import org.apache.metamodel.UpdateCallback;
import org.apache.metamodel.UpdateScript;
import org.apache.metamodel.UpdateableDataContext;
import org.apache.metamodel.data.DataSet;
import org.apache.metamodel.excel.ExcelDataContext;
/*import org.apache.metamodel.jdbc.JdbcDataContext;*/
import org.apache.metamodel.query.Query;
import org.apache.metamodel.schema.ColumnType;
import org.apache.metamodel.schema.Schema;
import org.apache.metamodel.schema.Table;

public class tabtopostgres {

private static final String CONNECTION_STRING = "driverManager://url/dbname";
private static final String USERNAME = "  ";
private static final String PASSWORD = " ";

/**
* @param args
*/
public static  void main(String[] args) throws Exception {
Connection connection = null;
Table table = null;


try {
Class.forName("org.postgresql.Driver");

connection = DriverManager.getConnection("jdbc:postgresql://url/dbname","username","password");
                                                                 System.out.println("started1:"+connection);

JdbcDataContext dc = new JdbcDataContext(connection);

UpdateableDataContext excel = new ExcelDataContext(new File("C:/Users/user/Desktop/student1.xlsx"));

final Schema schema = excel.getDefaultSchema();


table = schema.getTables()[0];
System.out.println("started2:"+dc);
           
System.out.println("started3:"+schema);
Query q = new Query();

q.from(table);
q.select(table.getColumns());
System.out.println("Columns: " + Arrays.toString(table.getColumnNames()));
DataSet ds = excel.query().from(table).select(table.getColumns()).execute();
while(ds.next()) {
System.out.println(">>> "+ds.getRow());

}


                   ds.close();
PostgresqlMain psm = new PostgresqlMain();
psm.Add();
psm.main(null);

                       }
                            catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}

}
}
OUTPUT FOR THE ABOVE PROGRAM:

started1:org.postgresql.jdbc.PgConnection@18e6db6
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
started2:com.nic.audit.JdbcDataContext@b87145
started3:Schema[name=student1.xlsx]
Columns: [id, name, gender, age]
EXCEL FILE--->>"student1.xlsx"
SHEET--1
id name gender age
1 abi female 16
2 banu female 16
3 cibi female 18
4 divi female 20
5 elakiya female 21
6 fahir male 25
7 goki male 21
8 deep male 19
9 pavi female 23

SHEET--2
id name gender age
1 Raja male 25
2 ravi male 25
3 selva male 25
4 sara male 98
5 praveena male 105
6 jeevitha female 31

SHEET--3
jio sdf sdfs sdfsd sdfsdf sdfsdf
1 2 3 4 5 6
2 2 3 4 5 6
3 2 3 4 5 6
4 2 3 4 5 6
5 2 3 4 5 6
6 2 3 4 5 6
7 2 3 4 5 6
8 2 3 4 5 6
9 2 3 4 5 6
10 2 3 4 5 6
11 2 3 4 5 6
12 2 3 4 5 6
13 2 3 4 5 6
14 2 3 4 5 6
15 2 3 4 5 6
16 2 3 4 5 6
17 2 3 4 5 6
18 2 3 4 5 6
19 2 3 4 5 6
20 2 3 4 5 6
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB