Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.13 KB

HowToMaven.md

File metadata and controls

38 lines (30 loc) · 1.13 KB

How to setup maven dependencies

Introduction

This page describes maven configuration required to get dependecies

Details =

      <dependency>
          <groupId>com.google.code.sqlsheet</groupId>
          <artifactId>sqlsheet</artifactId>
          <version>6.5</version>
      </dependency>
  • Use it
Class.forName("com.googlecode.sqlsheet.Driver");

Connection writeConnection = DriverManager.getConnection("jdbc:xls:file:test.xlsx");

Statement writeStatement = writeConnection.createStatement();

writeStatement.executeUpdate("CREATE TABLE TEST_INSERT(COL1 INT, COL2 VARCHAR(255), COL3 DATE)");

PreparedStatement writeStatement2 =
writeConnection.prepareStatement("INSERT INTO TEST_INSERT(COL1, COL2, COL3) VALUES(?,?,?)");

for(int i = 0; i<3;i++){
  writeStatement2.setDouble(1, i);
  writeStatement2.setString(2, "Row" + i);
  writeStatement2.setDate(3, new java.sql.Date(new Date().getTime()));
  writeStatement2.execute();
}

writeStatement.close();
writeStatement2.close();
writeConnection.close();