gpt4 book ai didi

java - 未报告的异常 java.sql.SQLException;必须被捕获或宣布被抛出?

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:52:26 25 4
gpt4 key购买 nike

<分区>

我在尝试编译以下代码时遇到此错误。我想知道我做错了什么。

unreported exception java.sql.SQLException; must be caught or declared to be thrown Class.forName(myDriver);               ^
private void setupInfo() {

Driver driver = new org.gjt.mm.mysql.Driver();
String url = "jdbc:mysql://localhost:3306/test";
String username = "root";
String password = "123456";

String problemFeatureSpecTableName = "ProblemFeatureSpec";
String solutionFeatureSpectTableName = "SolutionFeatureSpec";
String classTableName = "Class";
String extraDataTableName = "ExtraData";
String casebaseTablename = "CaseBase";
String problemTableName = "Problem";
String solutionTableName = "Solution";
String inactiveContextsTableName = "InactiveContext";
String constantsTableName = "Constants";
dbInfo = new DBInfo(new JDBCDriverInfo(driverName, url, username, password),constantsTableName);
problemSpecInfo = new FeatureSpecRDBInfo(problemFeatureSpecTableName, classTableName, extraDataTableName);
solutionSpecInfo = new FeatureSpecRDBInfo(solutionFeatureSpectTableName, classTableName, extraDataTableName);
rdbCasebaseInfo = new RDBCaseBaseInfo(casebaseTablename, solutionTableName, problemTableName, inactiveContextsTableName);
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com