连接数据库

public class jdbctest {
public static void main(String[] args) throws Exception{
String url="jdbc:mysql://localhost:3306/da?useUnicode=true&characterEncoding=utf8";
String user="root";
String password="";
Connection conn=null;
Statement st=null;
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection connection = DriverManager.getConnection(url,user,password);


} catch (Exception e) {
e.printStackTrace();
}finally{
conn.close();
}
}
}
posted @   涨涨涨张  阅读(3)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
点击右上角即可分享
微信分享提示