Re: mysql connectivity problem with ApachNetbeans 18:Exception: com.mysql.jdbc.Driver
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 > > 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> > > > 4.0.0 > com.mycompany > DB1mav > 1.0-SNAPSHOT > jar > > mysql > mysql-connector-j > 8.0.xx > > > UTF-8 > 11 > 11 > com.mycompany.db1mav.DB1mav > > > > > > 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 ...\n > ... @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 > ...\n... @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 > wrote: > > > In your maven project check if you have: > >1. Proper dependency for the MySQL driver in your pom.xml file. I.e. > > > > mysql > > mysql-connector-java > > 8.0.xx > > > >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 > > *Sent:* Monday, August 21, 2023 9:42 PM > *To:* NetBeans Mailing List > > *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 al
Re: mysql connectivity problem with ApachNetbeans 18:Exception: com.mysql.jdbc.Driver .
The Java classe driver Is changed. The new driver class Is: com.mysql.cj.jdbc.Driver Class.forName("com.mysql.cj.jdbc.Driver") https://stackoverflow.com/questions/52032739/loading-class-com-mysql-jdbc-driver-this-is-deprecated-the-new-driver-class Il mer 9 ago 2023, 06:23 Zulfi Khan ha scritto: > 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. > >
Re: mysql connectivity problem with ApachNetbeans 18:Exception: com.mysql.jdbc.Driver
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 http://maven.apache.org/POM/4.0.0; xmlns:xsi="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;> 4.0.0 com.mycompany DB1mav 1.0-SNAPSHOT jar mysql mysql-connector-j 8.0.xx UTF-8 11 11 com.mycompany.db1mav.DB1mav 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 ...\n ... @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 ...\n ... @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 wrote: In your maven project check if you have: 1. Proper dependency for the MySQL driver in your pom.xml file. I.e. mysql mysql-connector-java 8.0.xx 2. After the build check you .m2/repository/mysql directory to see if the jar file was downloaded 3. Open this jar file with tar, 7-zip or any other proper utility and find if your driver class is there. *From:* Zulfi Khan *Sent:* Monday, August 21, 2023 9:42 PM *To:* NetBeans Mailing List *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
Re: mysql connectivity problem with ApachNetbeans 18:Exception: com.mysql.jdbc.Driver
sspath. > > *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> * > > > > *Java Database Connectivity || How to connect MYSQL and NetBeans 18 || > #j... <https://www.youtube.com/watch?v=rgF-5CwTZeE>* > > Java Database Connectivity || How to connect MYSQL and NetBeans 18 || #j... > > <https://www.youtube.com/watch?v=rgF-5CwTZeE> > > > > [image: Play] > > > *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> * > > *Java Database Connectivity || How to connect MYSQL and NetBeans 18 || > #j... <https://www.youtube.com/watch?v=rgF-5CwTZeE>* > > > *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 > 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 > *Sent:* Tuesday, August 8, 2023 9:23 PM > *To:* NetBeans Mailing List > *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
Re: mysql connectivity problem with ApachNetbeans 18:Exception: com.mysql.jdbc.Driver
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: [image: image.png] You can manage the classpath from the project properties [image: image.png] Hope it helps On Sat, Aug 12, 2023 at 10:00 PM Zulfi Khan 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> * > > > > > *Java Database Connectivity || How to connect MYSQL and NetBeans 18 || > #j... <https://www.youtube.com/watch?v=rgF-5CwTZeE>Java Database > Connectivity || How to connect MYSQL and NetBeans 18 || #j... > <https://www.youtube.com/watch?v=rgF-5CwTZeE>* > > > > [image: Play] > > > *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> * > > *Java Database Connectivity || How to connect MYSQL and NetBeans 18 || > #j... <https://www.youtube.com/watch?v=rgF-5CwTZeE>* > > > *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 > 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 > *Sent:* Tuesday, August 8, 2023 9:23 PM > *To:* NetBeans Mailing List > *Subject:* mysql connectivity problem with ApachNetbeans 18:Exception: > com.mysql.jdb
RE: mysql connectivity problem with ApachNetbeans 18:Exception: com.mysql.jdbc.Driver
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 Sent: Tuesday, August 8, 2023 9:23 PM To: NetBeans Mailing List 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.
Re: mysql connectivity problem with ApachNetbeans 18:Exception: com.mysql.jdbc.Driver
Zulfi, you will need to add the MySQL JDBC Driver to the classpath (or the program you are running). And maybe you will want to look for a General Java Programming Forum or List. Apache Netbeans is meant for concerns about the IDE. Good luck and regards Andreas On Wed, 2023-08-09 at 04:22 +, Zulfi Khan wrote: > 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. >
mysql connectivity problem with ApachNetbeans 18:Exception: com.mysql.jdbc.Driver
Hi, Mysql driver erroron Apachi netbeans 18.0 Hi, I am working onubuntu 18.04. mysql version is: mysql Ver 14.14Distrib 5.7.42, for Linux (x86_64) using EditLine wrapper I have written thefollowing code for connecting with database: importjava.sql.Connection; importjava.sql.DriverManager; importjava.sql.SQLException; import java.sql.*; public classDbconnect { booleanconnect(){ Connectioncon = 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; intqty; 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 thefollowing error: Starts1... Exception:com.mysql.jdbc.Driver Starts2... BUILD SUCCESSFUL(total time: 13 seconds) Somebody, pleaseguide me. Zulfi.