java连接数据库为什么去掉try就报错
java连接try{dbConn=DriverManager.getConnection(dbURL,userName,userPwd);System.out.print...
java 连接
try
{
dbConn = DriverManager.getConnection(dbURL, userName, userPwd);
System.out.println("连接数据库成功");
String sql="insert into users(username,password,age,sex) values('小别','123456',22,0)";
Statement stmt=dbConn.createStatement();
stmt.executeUpdate(sql);
} 展开
try
{
dbConn = DriverManager.getConnection(dbURL, userName, userPwd);
System.out.println("连接数据库成功");
String sql="insert into users(username,password,age,sex) values('小别','123456',22,0)";
Statement stmt=dbConn.createStatement();
stmt.executeUpdate(sql);
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询