What Richard said.

Also, you need to choose an actual version of MySql, not just "8.0.xx" 8.1.0
<https://mvnrepository.com/artifact/com.mysql/mysql-connector-j/8.1.0> seems
to be the latest one.



On Fri, Aug 25, 2023 at 10:40 PM Richard Grin <
richard.g...@univ-cotedazur.fr> wrote:

> Hi,
>
> Put dependency into a dependencies tag.
>
> Richard
> Le 26/08/2023 à 07:12, Zulfi Khan a écrit :
>
> Hi,
> dependency information to pom.xml gives error. Below i smy pom.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0";
> <http://maven.apache.org/POM/4.0.0> xmlns:xsi=
> "http://www.w3.org/2001/XMLSchema-instance";
> <http://www.w3.org/2001/XMLSchema-instance> 
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd";
> <http://maven.apache.org/POM/4.0.0http://maven.apache.org/xsd/maven-4.0.0.xsd>
> >
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>com.mycompany</groupId>
>     <artifactId>DB1mav</artifactId>
>     <version>1.0-SNAPSHOT</version>
>     <packaging>jar</packaging>
>     <dependency>
>         <groupId>mysql</groupId>
>         <artifactId>mysql-connector-j</artifactId>
>         <version>8.0.xx</version>
>         </dependency>
>     <properties>
>         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>         <maven.compiler.source>11</maven.compiler.source>
>         <maven.compiler.target>11</maven.compiler.target>
>         <exec.mainClass>com.mycompany.db1mav.DB1mav</exec.mainClass>
>
>     </properties>
>
>
> </project>
>  I am getting th efollowing error message:
> [ERROR] Some problems were encountered while processing the POMs:
> Malformed POM /home/zulfi/NetBeansProjects/DB1mav/pom.xml: Unrecognised
> tag: 'dependency' (position: START_TAG seen ...</packaging>\n
> <dependency>... @8:17)  @ /home/zulfi/NetBeansProjects/DB1mav/pom.xml, line
> 8, column 17
>  @
> The build could not read 1 project -> [Help 1]
>
>   The project com.mycompany:DB1mav:1.0-SNAPSHOT
> (/home/zulfi/NetBeansProjects/DB1mav/pom.xml) has 1 error
>     Malformed POM /home/zulfi/NetBeansProjects/DB1mav/pom.xml:
> Unrecognised tag: 'dependency' (position: START_TAG seen
> ...</packaging>\n    <dependency>... @8:17)  @
> /home/zulfi/NetBeansProjects/DB1mav/pom.xml, line 8, column 17 -> [Help 2]
>
> To see the full stack trace of the errors, re-run Maven with the -e switch.
> Re-run Maven using the -X switch to enable full debug logging.
>
> For more information about the errors and possible solutions, please read
> the following articles:
> [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
> [Help 2]
> http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException
>
> Somebody please guide me.
>
> Zulfi.
>
>
>
> On Tuesday, August 22, 2023 at 02:10:34 PM CDT, Greenberg, Gary
> <ggree...@visa.com.invalid> <ggree...@visa.com.invalid> wrote:
>
>
> In your maven project check if you have:
>
>    1. Proper dependency for the MySQL driver in your pom.xml file. I.e.
>
> <dependency>
>
>     <groupId>mysql</groupId>
>
>     <artifactId>mysql-connector-java</artifactId>
>
>     <version>8.0.xx</version>
>
> </dependency>
>
>    1. After the build check you .m2/repository/mysql directory to see if
>    the jar file was downloaded
>    2. Open this jar file with tar, 7-zip or any other proper utility and
>    find if your driver class is there.
>
>
>
> *From:* Zulfi Khan <zulfi6...@yahoo.com.INVALID>
> <zulfi6...@yahoo.com.INVALID>
> *Sent:* Monday, August 21, 2023 9:42 PM
> *To:* NetBeans Mailing List <users@netbeans.apache.org>
> <users@netbeans.apache.org>
> *Subject:* Re: mysql connectivity problem with ApachNetbeans
> 18:Exception: com.mysql.jdbc.Driver
>
>
>
> Hi,
>
> Thanks for your response.
>
> (a)Mavern Project:
>
> I have started a mavern project “DB1mav”. I have attached an image of the
> execution screen (file: ExecutionScreen of Mavern Project.png) which shows
> the messages:
>
> Starts1...
>
> Starts2…
>
> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
>
> at
> java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
>
> at
> java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
>
> at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
>
> at java.base/java.lang.Class.forName0(Native Method)
>
> t at java.base/java.lang.Class.forName(Class.java:315)
>
> at com.mycompany.db1mav.Dbconnect.connect(DB1ConnectMav.java:22)
>
> :
>
> :
>
> This means I still have no clue for ClassNotFoundException
>
> (b)Catch Block Code Changed:
>
> I have replaced the command for error messsage in both the catch blocks as
> shown below :
>
>
>
> } catch(Exception e) {
>
> //System.err.println("Exception: " + e.getMessage());
>
> e.printStackTrace(System.err);
>
> } finally {
>
> try {
>
> if (con != null){
>
> con.close();
>
> return true;
>
> }
>
> } catch(SQLException e) {//System.err.println("Exception2: " +
> e.getMessage());
>
> e.printStackTrace(System.err);
>
>
>
> (c)Class path:
>
> I have checked your images. The small image shows the folders which I also
> have instead of Libraries. I have shown this in my image “No libraries
> folder in project and in properties.png”. The image also contains
> properties popped up screen (i.e., screen which I popped on the project
> properties) i.e. categories. Items in my categories are different. The
> popped up screen (i.e., categories) show Javascript libraries option but no
> libraries option.
>
>
>
> I am not able to set Class path because I don’t have Libraries folder in
> my mavern project. Please guide me. I hae different stuff than your first
> black image.
>
>
>
> (d) Red connection failed message (i.e., in file connection failed.png)
>
> I have also attached the image which shows the “connection failed access
> denied message...” in the Connectionfailed.png file. The red message if you
> can’t read in the image is ,given below:
>
>
>
> Connection failed: Access denied for user 
> 'root@localhost'(jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=CONVERT_TO_NULL
> using com.mysql.cj.jdbc.Driver)
>
>
>
> What I have to do for this red message? Should I try to delete the drivers
> which I installed in the Ant project?
>
>
>
> (e) Jar file
>
> I tried to add the jar in the path. Hence I clicked on the Services. It
> showed me Databases folder and two folders under it:
>
> MySQL Server at localhost:3306[root](disconnected),
>
> Java DB
>
> and below this was:
>
> Drivers and below at 5th position I saw
>
> MySDL(Connector/ J Driver)
>
>
>
>
>
> Please guide me.
>
>
>
> Zulfi.
>
>
>
>
>
> On Monday, August 14, 2023 at 12:36:44 PM CDT, Juan Algaba
> <jalg...@colef.mx> <jalg...@colef.mx> wrote:
>
>
>
>
>
>
>
> Don't print your exceptions this way:
>
>
>
> System.err.println("Exception: " + e.getMessage());
>
>
>
> This will hide the type of the original exception, and the root exception
> (if any). A better way is
>
>
>
> e.printStackTrace(System.err);
>
>
>
> Which will show that it's a ClassNotFoundException, the exact line where
> the exception happened and where it was called from. The more information
> you give people trying to help you the better.
>
>
>
> The tutorial is using Java with Ant to set up the project. I
> recommend Java with Maven otherwise less people will be able to help you
> because less people use Ant, and the type of project greatly affects how
> dependencies (libraries) are added to the project. But that's beside the
> point.
>
>
>
> The issue seems to be that you added the *folder* containing the jar
> file, not the jar file itself. Here are some screenshots to show you the
> difference:
>
>
>
> You can manage the classpath from the project properties
>
>
>
> Hope it helps
>
>
>
> On Sat, Aug 12, 2023 at 10:00 PM Zulfi Khan <zulfi6...@yahoo.com.invalid>
> <zulfi6...@yahoo.com.invalid> wrote:
>
>
>
>
>
> Hi,
>
> I checked it in the video my code is right. If any file not included
> kindly let me know explicitly. Please guide me how to include classpath.
>
> *video:*
>
> *https://www.youtube.com/watch?v=rgF-5CwTZeE
> <https://www.youtube.com/watch?v=rgF-5CwTZeE>*
>
>
>
> *Hi,*
>
> *I was watching this video:Java Database Connectivity || How to connect
> MYSQL and NetBeans 18 || #jdbc #jdbctutorial#jdbcinjava
> <https://www.youtube.com/watch?v=rgF-5CwTZeE> *
>
>
>
>
> [image: Image removed by sender.]
> Java Database Connectivity || How to connect MYSQL and NetBeans 18 || #j...
>
>
>
>
> [image: Image removed by sender.]
> Java Database Connectivity || How to connect MYSQL and NetBeans 18 || #j...
>
>
>
>
>
>
>
> *Error! Filename not specified.*
>
>
>
>
>
> *and then I downloaded the driver:*
>
> *mysql-connector-j-8.1.0 but I also installed:
> mysql-connector-j-8.0.33-1ubuntu18.004_all and is also part of my project’s
> library.*
>
>
>
> *I am getting the following output:*
>
> *Starts1...*
>
> *Exception: com.mysql.jdbc.Driver*
>
> *Starts2...*
>
> *BUILD SUCCESSFUL (total time: 32 seconds)*
>
>
>
> *I have attached the following images, R1..., R2…., R3….:*
>
> *R1: shows ubuntu driver attached to my project’s library, I am trying to
> remove it but the option is greyed.*
>
> *R2:shows installation of another mysql-connector-j*
>
> *R3:shows the poped window when I clicked the services window*
>
> *I have put my question on the reddit forum but they are not able to guide
> me.*
>
>
>
> *Please solve  my problem.*
>
>
>
> *Zulfi.*
>
>
>
> On Saturday, August 12, 2023 at 11:57:17 PM CDT, Zulfi Khan <
> zulfi6...@yahoo.com> wrote:
>
>
>
>
>
>
>
> Hi,
>
> I checked it in the video my code is right. If any file not included
> kindly let me know explicitly. Please guide me how to include classpath.
>
> *video:*
>
> *https://www.youtube.com/watch?v=rgF-5CwTZeE
> <https://www.youtube.com/watch?v=rgF-5CwTZeE>*
>
>
>
> *Hi,*
>
> *I was watching this video:Java Database Connectivity || How to connect
> MYSQL and NetBeans 18 || #jdbc #jdbctutorial#jdbcinjava
> <https://www.youtube.com/watch?v=rgF-5CwTZeE> *
>
>
>
>
> [image: Image removed by sender.]
> Java Database Connectivity || How to connect MYSQL and NetBeans 18 || #j...
>
>
>
>
>
> *and then I downloaded the driver:*
>
> *mysql-connector-j-8.1.0 but I also installed:
> mysql-connector-j-8.0.33-1ubuntu18.004_all and is also part of my project’s
> library.*
>
>
>
> *I am getting the following output:*
>
> *Starts1...*
>
> *Exception: com.mysql.jdbc.Driver*
>
> *Starts2...*
>
> *BUILD SUCCESSFUL (total time: 32 seconds)*
>
>
>
> *I have attached the following images, R1..., R2…., R3….:*
>
> *R1: shows ubuntu driver attached to my project’s library, I am trying to
> remove it but the option is greyed.*
>
> *R2:shows installation of another mysql-connector-j*
>
> *R3:shows the poped window when I clicked the services window*
>
> *I have put my question on the reddit forum but they are not able to guide
> me.*
>
>
>
> *Please solve  my problem.*
>
>
>
> *Zulfi.*
>
>
>
>
>
>
>
>
>
> On Wednesday, August 9, 2023 at 11:37:35 AM CDT, Greenberg, Gary
> <ggree...@visa.com.invalid> <ggree...@visa.com.invalid> wrote:
>
>
>
>
>
>    1. This is not a netbeans question you are asking.
>    2. There is not enough info, but IMHO you did not include MySQL jar
>    file in you dependencies in your project.
>
>
>
> *From:* Zulfi Khan <zulfi6...@yahoo.com.INVALID>
> <zulfi6...@yahoo.com.INVALID>
> *Sent:* Tuesday, August 8, 2023 9:23 PM
> *To:* NetBeans Mailing List <users@netbeans.apache.org>
> *Subject:* mysql connectivity problem with ApachNetbeans 18:Exception:
> com.mysql.jdbc.Driver
>
>
>
> Hi,
>
>
>
> Mysql driver error on Apachi netbeans 18.0
>
>
>
> Hi,
>
> I am working on ubuntu 18.04. mysql version is:
>
> mysql Ver 14.14 Distrib 5.7.42, for Linux (x86_64) using EditLine wrapper
>
>
>
> I have written the following code for connecting with database:
>
> import java.sql.Connection;
>
> import java.sql.DriverManager;
>
> import java.sql.SQLException;
>
> import java.sql.*;
>
> public class Dbconnect {
>
> boolean connect(){
>
> Connection con = null;
>
> System.out.println("Starts1...");
>
> try {
>
> System.out.println("Starts2...");
>
> Class.forName("com.mysql.jdbc.Driver");
>
> con = DriverManager.getConnection("jdbc:mysql://ebookshop", "root", "");
>
> System.out.println("Starts3...");
>
> if (!con.isClosed()){
>
> System.out.println("Successfully connected to MySQL server...");
>
> Statement stmt = con.createStatement();
>
> String sql = "select * from books";
>
> ResultSet rs = stmt.executeQuery(sql);
>
> String title;
>
> String author;
>
> float price;
>
> int qty;
>
> while(rs.next()){
>
> title = rs.getString("title");
>
> author = rs.getString("author");
>
> price = rs.getFloat("price");
>
> System.out.println("title ="+title+"author="+author+"price="+price);
>
> }
>
> }
>
> } catch(Exception e) {
>
> System.err.println("Exception: " + e.getMessage());
>
> } finally {
>
> try {
>
> if (con != null){
>
> con.close();
>
> return true;
>
> }
>
> } catch(SQLException e) {}
>
> }
>
> return false;
>
> }
>
>
>
> I am getting the following error:
>
>
>
> Starts1...
>
> Exception: com.mysql.jdbc.Driver
>
> Starts2...
>
> BUILD SUCCESSFUL (total time: 13 seconds)
>
>
>
> Somebody, please guide me.
>
>
>
> Zulfi.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
> For additional commands, e-mail: users-h...@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>
>
> --
>
> - Juan Algaba
>
>
>
> *“La información de este correo, así como sus documentos adjuntos, puede
> ser objeto de solicitudes de acceso a la información; así como, de
> solicitudes en el ejercicio de los derechos de Acceso, Rectificación,
> Cancelación, Oposición y Portabilidad de datos personales (derechos
> ARCOP)”.*
>
>
>
> *"Este mensaje y cualquier archivo adjunto al mismo pueden contener
> información que podría considerarse confidencial y/o reservada. Si ha
> recibido el mensaje por error, por favor notifique al remitente contestando
> el correo, y destruyendo el mensaje original y sus anexos, como una medida
> de seguridad de carácter administrativo, conforme a lo estableció en el
> artículo 3, fracción XXI de la Ley General de Protección de Datos
> Personales en Posesión de Sujetos Obligados"*.
>
>
>
> *“La información contenida en este correo electrónico y sus anexos, está
> dirigida únicamente para el uso del individuo o entidad a la que fue
> dirigida y puede contener información propietaria que no es de dominio
> público. Cualquier uso, distribución o reproducción indebida será causa de
> sanción, de acuerdo a lo establecido en el artículo 163, fracción III de la
> Ley General de Protección de Datos Personales en Posesión de Sujetos
> Obligados y artículo 186, fracción IV de la Ley Federal de Transparencia y
> Acceso a la Información Pública”.*
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
> For additional commands, e-mail: users-h...@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, 
> visit:https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

-- 

-Juan Algaba

-- 


*“La información de este correo, así como sus documentos adjuntos, puede 
ser objeto de solicitudes de acceso a la información; así como, de 
solicitudes en el ejercicio de los derechos de Acceso, Rectificación, 
Cancelación, Oposición y Portabilidad de datos personales (derechos 
ARCOP)”.*****

*** ***

*"Este mensaje y cualquier archivo adjunto al mismo 
pueden contener información que podría considerarse confidencial y/o 
reservada. Si ha recibido el mensaje por error, por favor notifique al 
remitente contestando el correo, y destruyendo el mensaje original y sus 
anexos, como una medida de seguridad de carácter administrativo, conforme a 
lo estableció en el artículo 3, fracción XXI de la Ley General de 
Protección de Datos Personales en Posesión de Sujetos Obligados"*.****

** 
**

“La información contenida en este correo electrónico y sus anexos, está 
dirigida únicamente para el uso del individuo o entidad a la que fue 
dirigida y puede contener información propietaria que no es de dominio 
público. Cualquier uso, distribución o reproducción indebida será causa de 
sanción, de acuerdo a lo establecido en el artículo 163, fracción III de la 
Ley General de Protección de Datos Personales en Posesión de Sujetos 
Obligados y artículo 186, fracción IV de la Ley Federal de Transparencia y 
Acceso a la Información Pública”.

Reply via email to