在myeclipse中配置DB Driver(数据库用MySql),并在myeclipse执行sql语句操作
MyEclipse6.5 , mysq驱动jar包为mysql-connector-java-5.1.8-bin.jar
在MyEclipse中添加hibernate支持时需要用到DB Driver所以需要配置
首先选择window-->Open Perspective-->Other
出现下图:选择MyEclipse Database Explore.
![在myeclipse中配置DB Driver(数据库用MySql),并在myeclipse执行sql语句操作 - 雨 - Rainning](http://img8.ph.126.net/iXCu8Y7_2DMFsC_NO3om2w==/2392537302057638038.png)
点击OK后出现如下画面:
![在myeclipse中配置DB Driver(数据库用MySql),并在myeclipse执行sql语句操作 - 雨 - Rainning](http://img7.ph.126.net/nWx-YaK3QiaNAP7Mbd5s7A==/2588725360824964847.png)
点击右键选择 NEW创建连接,出现下图:Driver template选择 “MySQL Connector/J”
![在myeclipse中配置DB Driver(数据库用MySql),并在myeclipse执行sql语句操作 - 雨 - Rainning](http://img5.ph.126.net/qDynBoIE4czcTXg2R_w23Q==/2503438442881629345.png)
点击Finish后:如下图出现mysql的连接,右键 “mysql”,打开连接。输入密码,连接成功
![在myeclipse中配置DB Driver(数据库用MySql),并在myeclipse执行sql语句操作 - 雨 - Rainning](http://img8.ph.126.net/CgUBH1_c8xSgqZ6GelRcDg==/2657405255142359568.png)
成功后如下图,“Connected to mysql” 为一个连接到mysql数据库的连接,右键这个连接
,选则“New SQL Editor”,打开一个窗口
![在myeclipse中配置DB Driver(数据库用MySql),并在myeclipse执行sql语句操作 - 雨 - Rainning](http://img6.ph.126.net/D3LLRcCfntJLC7PKeAvp9g==/2477824220000966606.png)
可以在打开的窗口中写sql,执行sql语句
![在myeclipse中配置DB Driver(数据库用MySql),并在myeclipse执行sql语句操作 - 雨 - Rainning](http://img0.ph.126.net/Zlj04twYhCPM6-otaawOzw==/2798987168427822850.png)