Good morning, I am trying to connect a database with my code but at the time of executing the following exception:
"the JAR fie C: \ Program Files \ Java \ Jre1.8.0_151 \ ext \ mysql-connector-java-8.07-dmr-bin.jar has no source attachment. You can attach the source by clicking Attach Source below "
I've already tried it with other .jar mysql and even then, I thank you in advance for your contributions to solve the problem.
package prode;
import java.sql.*;
public class Conexion {
Connection con;
Statement st;
public Conexion(){
try{Class.forName("com.mysql.jdbc.Driver"); // en el debug llega a esta parte mostrando por class file editor la excepción; en ejecución no lanza errores, llega al catch mostrando conexión no establecida
con = DriverManager.getConnection("jdbc:mysql://localhost/prodemios?user=root&password=");
}catch(ClassNotFoundException|SQLException e){
System.out.println("conexion no establecida");
}
}
}
They gave me the solution to change the jre to jdk, but in doing so, it launches the following Error occurred during initialization of VM java.lang.UnsatisfiedLinkError: java.io.FileInputStream.available () I at java.io.FileInputStream.available (Native Method) at sun.nio.cs.StreamDecoder.inReady (Unknown Source) at sun.nio.cs.StreamDecoder.implRead (Unknown Source) at sun.nio.cs.StreamDecoder.read (Unknown Source) at java.io.InputStreamReader.read (Unknown Source) at java.io.BufferedReader.fill (Unknown Source) at java.io.BufferedReader.readLine (Unknown Source) at java.io.BufferedReader.readLine (Unknown Source) at sun.misc.MetaIndex.registerDirectory (Unknown Source) at sun.misc.Launcher $ ExtClassLoader $ 1.run (Unknown Source) at sun.misc.Launcher $ ExtClassLoader $ 1.run (Unknown Source) at java.security.AccessController.doPrivileged (Native Method) at sun.misc.Launcher $ ExtClassLoader.getExtClassLoader (Unknown Source) at sun.misc.Launcher. (Unknown Source) at sun.misc.Launcher. (Unknown Source) at java.lang.ClassLoader.initSystemClassLoader (Unknown Source) at java.lang.ClassLoader.getSystemClassLoader (Unknown Source)
Actually I'm working empirically and I'm not sure if I did well to change jre 151 to jdk 161 or 162 that it was with those who made the changes in the installed JREs, I looked for a jdk 151 to know if that was why the error but I can not find it, please ask for your help on this subject, thank you very much.