Java SQL Table createFreqTable()

Here you can find the source of createFreqTable()

Description

create Freq Table

License

Open Source License

Declaration

public static void createFreqTable() 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.*;

public class Main {
    static final String FREQ_TABLE = "freq";
    static final String ID = "ID";
    static final String CHROME = "Chrome";
    static final String POSITION = "position";
    static final String A = "A";
    static final String T = "T";
    static final String C = "C";
    static final String G = "G";
    static Connection connection;

    public static void createFreqTable() {
        try {//  ww  w. j av a2  s.  com
            Statement stmt = connection.createStatement();
            String sql = "CREATE TABLE IF NOT EXISTS " + FREQ_TABLE + "(" + ID
                    + " INTEGER PRIMARY KEY AUTOINCREMENT," + CHROME + " CHAR(10) NOT NULL," + POSITION
                    + " CHAR(20) NOT NULL," + A + " CHAR(10)," + T + " CHAR(10)," + C + " CHAR(10)," + G
                    + " CHAR(10), " + "UNIQUE (" + CHROME + "," + POSITION + ")" + ");";
            stmt.executeUpdate(sql);
            stmt.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        System.out.println("Create freq table successfully");
    }
}

Related

  1. columnExist(String table, String column, Connection con)
  2. constructObject(Class theClass, Connection db, int objectId, String tableName, String uniqueField)
  3. count(Connection conn, String table)
  4. countTables(Connection connection)
  5. createBagValuesTables(Connection con)
  6. createHSQLTables(LineNumberReader reader, Statement statement)
  7. createSourceTable(Connection con)
  8. createTable(Connection dbCon, String tableName, String fields)
  9. createTable(Statement statement, String spaceName, String minSeeders, String capacity, String replicationCount)