Java实现MySQL在线管理

问题:

1、如何实现在线创建MySQL数据库、表;

2、如何实现在线执行sql语句?

思路:

1、可以通过java.sql.Statement类的executeUpdate(String sql)方法实现。此方法支持DML, DDL操作。

int executeUpdate(String sql)
Executes the given SQL statement, which may be an INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement.

2、可以通过Runtime.getRuntime().exec(String [])来实现对数据库的操作。

 

具体细节可参考:

 

 

原文地址:https://www.cnblogs.com/toughhou/p/3778780.html