Review and start again——First Step JAVA web Program hotelmanagement:1.JDBC

In a whole program of java, the JDBC, a.k.a JAVA DataBase Connectivity is a problem that cannot be avoided. So today I will integrate something about the JDBC based on the the programe hotelmanagement.

Firstly: The format in the class: JDBC
Secondly: The produce and extract of documents .sql

Section1:
The following is the codeblock about the package in the program:

package db;
import java.sql.*;
public class JDBC {

public static Connection getConnection() throws Exception {
	String driverName = "com.mysql.jdbc.Driver";   //加载JDBC驱动
	String dbURL = "jdbc:mysql://localhost:3306/hotel";   //链接服务器
	String userName = "root";  //navicat中设置的用户名
	String userPwd = "123456"; //nabicat中设置的密码
	Class.forName(driverName);
	return DriverManager.getConnection(dbURL, userName, userPwd);
}
public static void main(String args[]){

}

}
generally there should be a statement about “Conn get statement or prepareStatement object for sql operation”

Section2: The produce and extract of documents .sql .
produce:
step1: open the “navicat for mysql”
step2: right click the database you’d like to produce a .sql document
step3: click the " dump a SQL document"
step4: choose the path and run

extract:
step1: open the “navicat for mysql”;
step2: new a new database in the navicat
step3: open the new database
step4: right click the new one and click the button"run the sql document"
step5: choose the path of the sql document which you would like to extract
step6: right click the block and refresh the database

integration-integrate整合
extract提取

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值