G
grape_LYH
Unregistered / Unconfirmed
GUEST, unregistred user!
采用JSP建表时,要创建备注型的字段应用什么类型。参看以下代码。另外这些类型都是
什么含义
BOOLEAN | CHARACTER [ VARYING ] | CHAR [ VARYING ] | SHORT
| LONG | VARCHAR | BIGDECIMAL | INTEGER
| INT | STRING | FLOAT | INPUTSTREAM
|do
UBLE [ PRECISION ]| OBJECT | SMALLINT | DECIMAL
| DEC | DATE | TIME | TIMESTAMP
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbcdbc:GrapeResource";
Connection con=DriverManager.getConnection(url);
//然后创建一个JDBC声明
Statement stmt = con.createStatement();
String query="CREATE TABLE Rooms" +
"(ID INT primary key,"+ //ID auto_increment
"ROOM VARCHAR(50),"+ //房间名
"OldLetter INT,"+ //旧贴子数
"NewLetter INT,"+ //新贴子数
"Group VARCHAR(50))";
//组名
//执行声明
stmt.executeUpdate(query);
query="CREATE TABLE letters" +
"(ID INT primary key,"+ //ID auto_increment
"RegDateTime DATE,"+ //注册时间
"NewDateTime DATE,"+ //最新时间
"Subject VARCHAR(200),"+ //标题
"RoomID INT,"+ //新贴子数
//"Content STRING),"+ //内容
"Parent INT,"+ //父贴子
"Status INT,"+ //状态
"GetTimes INT,"+ //读取数
"ReplyTimes INT)";
//回复数
//执行声明
stmt.executeUpdate(query);
}
catch (Exception e) {
out.println("faq(): " + e.getMessage());
}
什么含义
BOOLEAN | CHARACTER [ VARYING ] | CHAR [ VARYING ] | SHORT
| LONG | VARCHAR | BIGDECIMAL | INTEGER
| INT | STRING | FLOAT | INPUTSTREAM
|do
UBLE [ PRECISION ]| OBJECT | SMALLINT | DECIMAL
| DEC | DATE | TIME | TIMESTAMP
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbcdbc:GrapeResource";
Connection con=DriverManager.getConnection(url);
//然后创建一个JDBC声明
Statement stmt = con.createStatement();
String query="CREATE TABLE Rooms" +
"(ID INT primary key,"+ //ID auto_increment
"ROOM VARCHAR(50),"+ //房间名
"OldLetter INT,"+ //旧贴子数
"NewLetter INT,"+ //新贴子数
"Group VARCHAR(50))";
//组名
//执行声明
stmt.executeUpdate(query);
query="CREATE TABLE letters" +
"(ID INT primary key,"+ //ID auto_increment
"RegDateTime DATE,"+ //注册时间
"NewDateTime DATE,"+ //最新时间
"Subject VARCHAR(200),"+ //标题
"RoomID INT,"+ //新贴子数
//"Content STRING),"+ //内容
"Parent INT,"+ //父贴子
"Status INT,"+ //状态
"GetTimes INT,"+ //读取数
"ReplyTimes INT)";
//回复数
//执行声明
stmt.executeUpdate(query);
}
catch (Exception e) {
out.println("faq(): " + e.getMessage());
}