Example usage for java.sql SQLException printStackTrace

List of usage examples for java.sql SQLException printStackTrace

Introduction

In this page you can find the example usage for java.sql SQLException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:Main.java

public static void close() {
    try {// www. j  av  a 2 s. co m
        con.close();
    } catch (SQLException ex) {
        ex.printStackTrace();
    }
}

From source file:Main.java

public static void InsertTable1(Statement stmt, String package_name, String app_name, String decode_app,
        String has_sdk, String has_sdk_pro, String app_version, String app_url, String app_icon) {
    String sql = "INSERT INTO app_info.`pack_only_copy_8.12_copy`(package_name,app_name,decode_app,has_sdk,has_sdk_pro,app_version,app_url,app_icon)\n"
            + "VALUES('" + package_name + "','" + app_name + "','" + decode_app + "','" + has_sdk + "','"
            + has_sdk_pro + "','" + app_version + "','" + app_url + "','" + app_icon + "')";
    try {/*from  ww w  .  j  av  a  2s .  c o m*/
        stmt.executeUpdate(sql);
    } catch (SQLException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void UpdateTable1(Statement stmt, String package_name, String app_name, String decode_app,
        String has_sdk, String has_sdk_pro, String app_version, String app_url, String app_icon) {
    String sql = "UPDATE app_info.`pack_only_copy_8.12_copy` SET package_name='" + package_name
            + "',decode_app='" + decode_app + "',has_sdk='" + has_sdk + "',has_sdk_pro='" + has_sdk_pro
            + "',app_version='" + app_version + "',app_url='" + app_url + "',app_icon='" + app_icon + "'\n"
            + "WHERE app_name='" + app_name + "'";
    try {//  w w w .j a  v  a 2 s  .c  o  m
        stmt.executeUpdate(sql);
    } catch (SQLException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void UpdateTable2(Statement stmt, String package_name, String app_name, String app_versioncode,
        String decode_app, String has_sdk, String msp_version, String msp_pro, String app_url,
        String app_icon) {//from   w  w  w .  j a v  a2  s.c o m
    String sql = "UPDATE app_info.`msp_table_8.12_copy` SET package_name='" + package_name
            + "',app_versioncode='" + app_versioncode + "',decode_app='" + decode_app + "',has_sdk='" + has_sdk
            + "',msp_version='" + msp_version + "',msp_pro='" + msp_pro + "',app_url='" + app_url
            + "',app_icon='" + app_icon + "'\n" + "WHERE app_name='" + app_name + "'";
    try {
        stmt.executeUpdate(sql);
    } catch (SQLException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static String QueryVcTable2(Statement stmt, String app_name) {
    String sql_1 = "SELECT app_versioncode FROM app_info.`msp_table_8.12_copy` WHERE app_name='" + app_name
            + "'";
    ResultSet result = null;/* w  ww  . jav a  2s .c  om*/
    String v = null;
    try {
        result = stmt.executeQuery(sql_1);
        while (result.next()) {
            v = result.getString(1);
        }
        if (v != null)
            return v;
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:keepinchecker.setup.KeepInCheckerTestCase.java

private static void createTables(String databasePath) {
    ConnectionSource connectionSource;/*from   w  ww .  j  a  v  a  2s  .com*/
    try {
        connectionSource = new JdbcConnectionSource(databasePath);
        TableUtils.createTableIfNotExists(connectionSource, User.class);
        TableUtils.createTableIfNotExists(connectionSource, KeepInCheckerPacket.class);
    } catch (SQLException e) {
        e.printStackTrace();
    }
}

From source file:com.fmguler.ven.LiquibaseUtil.java

/**
 * Build the test database// w w w .  j a v  a  2s  .c om
 */
public static void buildDatabase() {
    try {
        Locale currLocale = Locale.getDefault();
        Locale.setDefault(Locale.ENGLISH);
        Database database = DatabaseFactory.getInstance()
                .findCorrectDatabaseImplementation(getDataSource().getConnection());
        Liquibase liquibase = new Liquibase("etc/test-db/test-db-changelog.xml", new FileSystemFileOpener(),
                database);
        liquibase.update("");
        Locale.setDefault(currLocale);
    } catch (SQLException ex) {
        ex.printStackTrace();
    } catch (JDBCException ex) {
        ex.printStackTrace();
    } catch (LiquibaseException ex) {
        ex.printStackTrace();
    }
}

From source file:com.fmguler.ven.LiquibaseUtil.java

/**
 * Undo all changes in the test database
 *//*from   ww w .  j a va  2 s  .  c  om*/
public static void rollbackDatabase(String tag) {
    try {
        Locale currLocale = Locale.getDefault();
        Locale.setDefault(Locale.ENGLISH);
        Database database = DatabaseFactory.getInstance()
                .findCorrectDatabaseImplementation(getDataSource().getConnection());
        Liquibase liquibase = new Liquibase("etc/test-db/test-db-changelog.xml", new FileSystemFileOpener(),
                database);
        liquibase.rollback(tag, "");
        Locale.setDefault(currLocale);
    } catch (SQLException ex) {
        ex.printStackTrace();
    } catch (JDBCException ex) {
        ex.printStackTrace();
    } catch (LiquibaseException ex) {
        ex.printStackTrace();
    }
}

From source file:com.egt.core.db.ddl.Writer.java

private static void execute(String vm, String clase) {
    if (VelocityEngineer.init()) {
        String c = clase == null ? "*" : clase;
        //          Utils.println("*** combinar(" + vm + ", clase=" + c + ") ***");
        MapaClases mapaClases = new MapaClases();
        try {//  w w  w  .ja  va2 s . c om
            if (mapaClases.connected()) {
                if (StringUtils.isNumeric(clase)) {
                    execute(vm, mapaClases.getMap(Long.valueOf(clase)));
                } else if (StringUtils.isNotBlank(clase)) {
                    execute(vm, mapaClases.getMap(clase));
                } else {
                    execute(vm, mapaClases.getMap());
                }
            } else {
                Utils.println("*** error de conexion ***");
            }
        } catch (SQLException ex) {
            ex.printStackTrace();
        } finally {
            if (mapaClases != null) {
                mapaClases.close();
                mapaClases = null;
            }
        }
    }
}

From source file:Classes.DBConnection.java

/**
 * Used to get a connection from database init
 * @return a connection to database/* w  ww.jav  a 2s  .  c om*/
 */
public static Connection getConnection() {
    Connection connection = null;

    try {
        connection = dataSource.getConnection();
    } catch (SQLException e) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(null, e.toString());
    }

    return connection;
}