Auth Fatal Unknown Database Driver Mysql
Resolve Unknown database in JDBC error with Java-MySQL?
This type of fault occurs if you select any database that does not be in MySQL. Let usa commencement display the mistake of unknown database in JDBC.
The Java code is as follows. Here, nosotros have ready the database equally 'onlinebookstore', which does non exist:
import java.sql.Connection; import java.sql.DriverManager; public form UnknownDatabaseDemo { public static void primary(String[] args) { String JdbcURL = "jdbc:mysql://localhost:3306/onlinebookstore?useSSL=false"; String Username = "root"; String password = "123456"; Connection con = zilch; try { con = DriverManager.getConnection(JdbcURL, Username, password); System.out.println("Connected to MySQL database"); } catch (Exception due east) { e.printStackTrace(); } } }
The following is the output displaying the same fault
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'onlinebookstore' at sunday.reverberate.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reverberate.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.coffee:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:871) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1714) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.coffee:1224) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2199) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2230) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.coffee:2025) at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:778) at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330) at java.sql.DriverManager.getConnection(Unknown Source) at coffee.sql.DriverManager.getConnection(Unknown Source) at UnknowDatabaseDemo.main(UnknowDatabaseDemo.java:15)
The screenshot of the error is equally follows
To remove this type of error, just go to MySQL control line and show all database names and use the chosen one from in that location i.due east. the database which really exist.
Here, nosotros have lots of database and I am going to cull database 'hb_student_tracker'. The post-obit is the listing of all database names, we got using Prove DATABASES command:
Hither is the JDBC lawmaking that connects the database "hb_student_tracker". The code is as follows:
import java.sql.Connexion; import java.sql.DriverManager; public class UnknownDatabaseDemo { public static void principal(String[] args) { String JdbcURL = "jdbc:mysql://localhost:3306/hb_student_tracker?useSSL=false"; String Username = "root"; Cord password = "123456"; Connection con = zip; try { con = DriverManager.getConnection(JdbcURL, Username, password); System.out.println("Connected to MySQL database"); } grab (Exception due east) { east.printStackTrace(); } } }
The screenshot is as follows displaying the output:
Updated on xxx-Jul-2019 22:thirty:25
- Related Questions & Answers
- Error 1046 No database Selected, how to resolve?
- How to resolve the ERROR 1115 (42000): Unknown character set: 'utf8mb4'?
- Resolve the MySQL error 'Type=MyISAM'?
- Resolve MySQL ERROR 1064 (42000): You accept an error in your syntax?
- Gear up Drop table view #1051 unknown tabular array error in MySQL
- Fix MySQL Database Error #1064?
- MySQL Error - #1046 - No database selected
- Resolve an error whenever multiple rows are returned in MySQL Criterion?
- Resolve Syntax error near "Club BY gild DESC" in MySQL?
- Getting a syntax error unknown fields in SAP ABAP
- Resolve the error Column count doesn't match value count in MySQL?
- Why the #1054 - Unknown column error occurs in MySQL and how to fix information technology?
- Connecting to a MySQL database with Java
- Fix ERROR 1064 (42000) while creating a database in MySQL?
- How to create a database in MySQL using a JDBC API?
Auth Fatal Unknown Database Driver Mysql,
Source: https://www.tutorialspoint.com/resolve-unknown-database-in-jdbc-error-with-java-mysql
Posted by: walshhism1966.blogspot.com
0 Response to "Auth Fatal Unknown Database Driver Mysql"
Post a Comment