急人之所急

hxs0117144 2010-10-14 09:46:12
求数据库的连接代码
...全文
46 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
hxs0117143 2010-10-14
  • 打赏
  • 举报
回复
<%@ page contentType="text/html; charset=gb2312" %>

<%@ page import=" java.util.*,java.sql.*,java.io.*" %>

<%

String driverName="com.mysql.jdbc.Driver";

String userName="root";

String userPasswd="123";

String dbName="test";

String url="jdbc:mysql://localhost:3306/"+dbName;

Class.forName("com.mysql.jdbc.Driver").newInstance();

Connection conn=DriverManager.getConnection(url,userName,userPasswd);

out.println("数据库连接成功!");

conn.close();

%>

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧