Java SQL Execute executeResource(Connection con, String resource)

Here you can find the source of executeResource(Connection con, String resource)

Description

execute Resource

License

Apache License

Declaration

private static void executeResource(Connection con, String resource)
            throws IOException, SQLException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;

import java.sql.SQLException;

public class Main {
    private static void executeResource(Connection con, String resource)
            throws IOException, SQLException {
        InputStream ins = Thread.currentThread().getContextClassLoader()
                .getResourceAsStream(resource);
        byte[] b = new byte[ins.available()];
        ins.read(b);//from  ww w  . j a  v a2 s .  co  m
        con.createStatement().execute(new String(b));
    }
}

Related

  1. executeImmediate(String sql)
  2. executeInsert(Connection conn, String sql, boolean hasAutoGeneratedKey, Object... parameters)
  3. executeInsert(Connection conn, String targetTable, String destinationTable)
  4. executeInsertSQL(String sql)
  5. executeQueries(Connection conn, InputStream stream)
  6. executeSetArgs(PreparedStatement stmt, Object... args)
  7. executeShutDownForHSQL(java.sql.Connection connection)
  8. executeSP(Connection conn, String spName, Object... parameters)
  9. executeSql(Connection conn, String sql)