gpt4 book ai didi

Java JDBC : connect cannot be resolved error

转载 作者:行者123 更新时间:2023-12-02 05:42:06 26 4
gpt4 key购买 nike

尝试使用以下代码时发生错误:

Connection.connect = DriverManager.getConnection(connectivityUrl,"root","root");
Statement state = connect.createStatement();

错误是:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: connect cannot be resolved or is not a field connect cannot be resolved

at DbConnectivity.main(DbConnectivity.java:15)

最佳答案

左侧变量声明不正确。它应该像下面这样

Connection connect = DriverManager.getConnection(connectivityUrl,"root","root");

关于Java JDBC : connect cannot be resolved error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56128105/

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