Executing SQL Statements Through JDBC
Data and schema modifications, if they are not returning any results, can be done through execute()
method of JdbcSession
:
public class Main { public static void main(String[] args) { new JdbcSession(source) .sql("CREATE TABLE foo (name VARCHAR(30))") .execute(); } }
You can also run a server instruction (for example, in PostgreSQL 9.2):
public class Main { public static void main(String[] args) { new JdbcSession(source) .sql("ANALYZE my_table") .execute(); } }