尝试获取连接字符串java时发生文件未找到错误

问题描述

我正在使用Eclipse IDE。一切都按书完成。将连接器添加到类路径。数据库工作正常。 Show table命令以cmd显示表格。但是在运行代码时仍然给出以下错误

Exception in thread "main" java.lang.Error: java.io.FileNotFoundException: C:\Users\Beta\AppData\Local\Temp\eoiAEF1.tmp\plugins\org.eclipse.justj.openjdk.hotspot.jre.minimal.stripped.win32.x86_64_14.0.2.v20200815-0932\jre\lib\tzdb.dat (The system cannot find the file specified)

下面是代码

package test;

import java.sql.*;
public class testDB {

    public static void main(String[] args) throws ClassNotFoundException {
        // Todo Auto-generated method stub
        System.out.println("Hello");
        try{  
            Class.forName("com.MysqL.cj.jdbc.Driver");  
            Connection con=DriverManager.getConnection("jdbc:MysqL://localhost:3306/sonoo","root","root");  
            //here sonoo is database name,root is username and password  
            Statement stmt=con.createStatement();  
            ResultSet rs=stmt.executeQuery("select * from emp");  
            while(rs.next())  
            System.out.println(rs.getInt(1)+"  "+rs.getString(2)+"  "+rs.getString(3));  
            con.close();  
            }
        catch(sqlException e){
            e.printstacktrace();
            } 
        catch(Exception e) {
            System.out.println(e);
        }

    }

}

任何帮助将不胜感激。谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)