java技术博客

jsp博客
数据加载中……
jdbcorache.jsp
<%@ page contentType="text/html;charset=gb2312"%>
<%@page import ="java.sql.*"%>
<%--
使用JDBC连接Oracle数据库
使用MLDN数据库
用户名:scott
密码:tiger
--%>
<%!
String DBDRIVER="oracle.jdbc.driver.OracleDriver";
String DBURL="jadb:oracle:thin:@localhost:1521:mldn";
String DBUSER="scott";
String DBPASSWORD="tiger";
Connection conn=null;
statement stmt=null;
%>
<%try{Class.forname(DBDRIVER);
conn=DriverManger.getConnection(DBURL,DBUSER,DBPASSWORD);
//create table
String sql="CREATE TABLE mldnab(name vachar(20))";
stmt=conn.createStatement();
stmt.executeUpdate(sql);
stmt.close();
conn.close();
}catch(Exception e){
out.println(e);

}


posted on 2008-10-22 16:37 郭兴华 阅读(76) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: