myeclipse编程提示如下错误:Syntax error on token ";", { expected after this token
importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;impor...
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class JDBCManager {
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String dbURL = "jdbc:sqlserver://localhost:1433;DatabaseName=DB_Radar"; // 数据库的URL地址
String userName = "sa"; // 用户名
String userPwd = "123"; // 密码
Connection conn = null;
try{
Class.forName(driverName);
conn = DriverManager.getConnection(dbURL, userName, userPwd);
System.out.println("数据连接建立成功!"); // 连接成功提示信息!
}catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}
return conn;
}
Connection conn = null;在这里出现错误,分号那边 展开
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class JDBCManager {
String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
String dbURL = "jdbc:sqlserver://localhost:1433;DatabaseName=DB_Radar"; // 数据库的URL地址
String userName = "sa"; // 用户名
String userPwd = "123"; // 密码
Connection conn = null;
try{
Class.forName(driverName);
conn = DriverManager.getConnection(dbURL, userName, userPwd);
System.out.println("数据连接建立成功!"); // 连接成功提示信息!
}catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}
return conn;
}
Connection conn = null;在这里出现错误,分号那边 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询