Eclipse giving error when adding MySql jdbc driver - mysql

I am getting below exception
A driver already exists with that name. Please provide a unique driver name.
Anyone tell me what i am doing wrong ?

Please follow: http://www.javahotchocolate.com/tutorials/jdbc.html
A driver already exists with that name. Please provide a unique driver name.
...until you remove the workspace's internal (but wrong) knowledge of that driver. (This process is more complicated than for a "simple" User Library.)
To remove a driver definition so that you can re-add it from scratch to match its actual location on disk:
Close the Build Path dialog.
Open workspace preferences (menu Window -> Preferences).
Expand Data Management by clicking its triangle.
Example Connectivity by clicking its triangle.
Click Driver Definitions.
Click on the offending definition, for the example in this article it would be "MySQL JDBC Driver | MySQL | 5.1" and then click Remove.
Dismiss the preferences dialog by clicking OK.
Return to Build Path in the project for which you need the MySQL JDBC driver and follow the steps to set up a new driver above.
If you experience trouble reaching Build Path, getting a weird error, bounce Eclipse (and return to the same workspace and project). You'll almost surely find that the problem has cleared and you can successfully follow the steps above again.

To reftify this error you need to change the Default Name of the driver (means change the Driver Name) Clear the doubt:

Related

Libreoffice base - "The driver class 'com.mysql.jdbc.Driver' could not be loaded" occurs even after adding class path

I am trying to connect Libreoffice base to an already existing database. To do so, I have done the following:
1)
2) I chose the "Connect using JDBC" option, and provided the database name and server. On testing class, it shows that the driver class has been loaded successfully.
3) I provided the user name and password and tested the connection, which gave me the following,
I am getting this error even though I provided the path to the .jar's. I have tried to restart libreoffice and also checked mysql.jar, for the jdbc driver (which was present) using the archive manager.
I tried referring to this at first,but the error still remained. How do I get rid of this error and establish the connection to the database ?

How to connect IntelliJ with local MySQL?

I have been struggling to learn how the localhost MySQL and IntelliJ to connect and program a database related task. Is that Possible? If yes, how to achieve it?
Connecting to a local instance is essentially the same as connecting to a remote instance of MySQL. Just substitute either localhost, or 127.0.0.1 in place of the IP address you would use normally.
To add a new database connection (called a data source in IntelliJ), open the Database window View -> Tool Windows -> Databases, then click the + sign and select Data Source and then MySQL from the sub-menu. The defaults for the MySQL connection should for a local install of MySQL.
To open a connection, right click on your new data source and select Open Console.
Official IntelliJ Documentation - Managing Data Sources
As of Community version 2017.2, the DB Browser does not come bundled with the IDE (at least not on my last two installations). In order to activate it, you should navigate in the IDE in **File->Settings->Plugins->Browse repositories and select "Database" from the dropdown menu. From there you can install the Database Navigator. After the installation has been successful, you should restart the IDE. Then you can select **View->Tool windows->DB Browser.
In recent versions of Idea Community (about 2017.3, but I am not sure) there is no Database tool available anymore, only in Idea Ultimate [1]. Yet worse, the plugin Database Navigator that would fit here to solve this problem is not compatible anymore, at least not with 2018.3 [2].
Uninstalling Idea right now, unfortunately.
[1] https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000411990-Database-option-not-available-under-View-Tool-Windows-in-Intellij-v2018-1-Community-Edition-
[2] https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001759260-Dan-Cioacas-Database-Navigator-plugin-v3-0-8222-0-is-incompatible-with-latest-IntelliJ-IDEA-2018-3
To add a new database connection (called a data source in IntelliJ), open the Database window View -> Tool Windows -> Databases, then click the + sign and select Data Source and then MySQL from the sub-menu. The defaults for the MySQL connection should for a local install of MySQL.
To open a connection, right click on your new data source and select Open Console.
to download Drivers click on "Download missing Drivers" in bottom of the window.
if you want to add JDBC and connect other database vendor like workbench projects (instead of using intelliJ Consol) just follow the steps bellow :
Using JDBC drivers #
Create a connection to a database with a JDBC driver #
If you cannot find a name of a database vendor in the list of data sources, download a JDBC driver for the database management system (DBMS), and create a connection in IntelliJ IDEA. With the JDBC driver, you can connect to DBMS and start working.
In the Database tool window (View | Tool Windows | Database), click the Data Source Properties icon.
In the Data Sources and Drivers dialog, click the Add icon (+) and select Driver and Data Source.
Click the User Driver link.
In the Driver files pane, click the Add icon and select Custom JARs.
Navigate to the JAR file of the JDBC driver, select it, and click
OK.
In the Class field, specify the value that you want to use for the
driver.
Click Apply.
Return to the created data source connection.
Specify database connection details. Alternatively, paste the JDBC URL in the URL field.
To set an empty password, right-click the Password field and select Set empty.
To ensure that the connection to the data source is successful,
click Test Connection.
For more information read the official answer of Jetbrains in following link :
Configuring database connections
https://www.jetbrains.com/help/idea/configuring-database-connections.html#Configuring_database_connections.xml
For anyone who is having trouble connecting IntelliJ Community Edition with MySQL in 2021.
(In IntelliJ Ultimate Database connectivity is supported by default and you can follow the steps shown in the previous answers. However IntelliJ Community Edition does not support it by Default).
Here is what you have to do:
Install "Database Navigator" Plugin. (Settings->Plugins->Marketplace->Search Database
Navigator and install)
Open DB Browser Tab (next to the button that opens/closes Project Window) -> Click Options logo
-> '+' -> Fill the Database fields (Name, host, Port, DB Name, User and Password).
Download the MySQL Java Connector
by searching google for 'java connector mysql'.
Go to File->
Project Structure -> Modules-> Dependencies. Click the '+' on the right side and select 'JARs or directories'.
Navigate and find the Java connector you just downloaded (the file
looks like this: mysql-connector-java-8.0.26.jar). Click apply
and in the project window, under External Libraries, you will see
the .jar file.
For WebStorm you need plugin "database-navigator"
https://plugins.jetbrains.com/plugin/1800-database-navigator

How to Connect MySql from Eclipse using Data Source Explorer

I need help. Could you please answer these question? I would like to connect eclipse to my database and I have tried these in eclipse: Window>Show View>Other>Data Source Explorer. After that we get Database Connections under the eclipse and then right click on the database connection and click on New... then select MySql under Connection Profile Types: and I click on New Driver Definition. Under New Driver Definition dialog, there exists MySql JDBC Driver with specific System Version. I choose one, but the OK button is disabled. Also at the top it says: "Unable to locate JAR/zip in file system as specified by the driver definition: mysql-connector-java-xxx-bin.jar".
How can I specify a Driver Template and Definition Name under New Driver Definition dialog of Data Source Explorer (in Data Tools Platform)
I dont know your Eclipse version or your MySql server version but for Kepler and mysql 5.5 server, here what I did. First I downloaded mysql connector java jar file(mysql-connector-java-5.1.36-bin.jar) from http://dev.mysql.com/downloads. Then On the New Driver Definition dialog page, I choose MySQL JDBC Driver|MySQL|5.1 under Name/Type tag. Go to JAR List tab Clear all and Add JAR/Zip... and choosed my already downloaded jar file. Finally at the Properties tab I filled them like this:
Connection URL: jdbc:mysql://localhost:3306
Database Name: MyDatabaseNameHere
Driver Class: com.mysql.jdbc.Driver
Password: MyPasswordHere
User ID: root
In the end, OK butten changed to enabled and that is all.
I also faced same issue. Just download the specific mysql JAR file needed. Now you need to add it to the JAR files tab. But before doing it click on clear all. That is the important step.

How to configure Squirrel SQL client to work with MS Access

I'm struggling to get Squirrel SQL to connect to MS Access database (just a normal one, no password):
I create an Alias and use Driver: JBDC ODBC bridge (There is a tick in front of this driver)
I don't know what to put in URL
-------- I use: Path to database file ~~> Unsuccessful
-------- I use: jdbc:odbc:Path to database file ~~> Unsuccessful
I'm running it on windows 7.
I guest this should be a simple straight forward process, but please advise me how to get it working.
Now that the JDBC-ODBC Bridge has been removed from Java 8 the previous answer to this question will become less relevant over time. The following method uses the UCanAccess JDBC driver so it will work with Java 8 and it will also work on non-Windows platforms.
First, make sure that you are using UCanAccess version 3.0.5 or later. Download the latest version of the UCanAccess driver (bin.zip file) and unzip it to a convenient location. For this example I unzipped it to
/home/gord/Downloads/JDBC/UCanAccess
Note: When unzipping the distribution file be sure to specify "Keep directory structure" (or similar, depending on your unzip tool) so the folder structure appears as in the screenshot above.
Creating a Squirrel SQL "Driver" entry (one-time setup)
In Squirrel SQL, create a new "Driver" entry for UCanAccess
and specify the location of loader/ucanload.jar on the "Extra Class Path" pane
Note: Remember to enter net.ucanaccess.jdbc.UcanloadDriver as the "Class Name" (see above).
Creating a database "Alias" (one for each database)
To open a specific database, create a Squirrel SQL "Alias" entry, replacing the <path_to_database_file> placeholder with the actual path to the file
or, in Windows
Important: Make sure that the connection URL ends with ;showSchema=true.
I found the solution. Put below string in URL:
(Assuming that path to your database file is D:\DBs\DatabaseFile.mdb)
jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=D:\DBs\DatabaseFile.mdb

JDeveloper MySQL error Driver not found

I am running MySQL db using the latest wamp server. Using Oracle JDeveloper 11g. I have placed the MySQL connector jar in .../jdeveloper/jdev/lib folder and added the jar as a library in my adf application .
. I am able to create a connection to the db, view the tables in DB Navigator of JDev, also create Entity and View Objects. However when I try to run the Application Module, I get an error popup saying could not create connection, driver not found. I have the ApplicationModule data source configuration set to JDBC Datasource.
Help!!!
. Thank you
Update :
The Error Log-----------------------------
[232] Using the oracle.jbo.server.ConnectionPoolDataSource to acquire a connection...
[233] Creating a new pool resource
[234] Trying connection/3: url='jdbc:mysql:/*****' user='root' password='*****' ...
[235] DBTransactionImpl.initTransaction: Login failed
[236] java.sql.SQLException: No suitable driver found for jdbc:mysql://127.0.0.1:3306/myDatabase
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at oracle.jbo.server.URLConnectionHelper.getConnection(URLConnectionHelper.java:187)
at oracle.jbo.server.URLConnectionHelper.getConnectionFromDriver(URLConnectionHelper.java:50)
at oracle.jbo.server.ConnectionPool.createConnection(ConnectionPool.java:195)
at oracle.jbo.server.ConnectionPool.instantiateResource(ConnectionPool.java:166)
at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:580)
at oracle.jbo.pool.ResourcePool.useResource(ResourcePool.java:313)
at oracle.jbo.server.ConnectionPool.getConnectionInternal(ConnectionPool.java:102)
The username and password used to connect to my database is correct, I am able to test it in the connection manager.
I am getting this error on run of Application Module, so I dont think the Integrated Weblogic Server is an issue here.
I have made sure that in libraries the mysql-connector jar is marked as "Deploy by default".
The jdbc jar file should also be placed where the embedded WebLogic can find it. So locate your defaultDomain directory under the JDeveloper's system directory /users/youruser/roaming/app data/JDeveloper
And locate the lib directory there.
Or make sure that the library you created in JDeveloper for the JDBC jar is marked as "Deploy by default".
put the mysql-connector**.jar in ~/.jdeveloper/xxxxxxx/DefaultDomain/lib
Configure JDeveloper to work with MySQL Connector/J
1-Download MySQL Connector/J 3.0.11 and copy the JDBC driver JAR file to a known location, such as /jdev/lib
From the Tools menu, select Default Project Properties.
In the tree view, select Libraries.
In the right pane, select New. The Create Library dialog will be displayed.
Name the library MySQL JDBC.
Set the location to Users Libraries.
Click Edit for the Class Path. The Edit Class Path dialog is displayed.
Click Add Entry. The Select Path Entry dialog is displayed.
Navigate to the JAR file for the MySQL Connect/J JDBC driver (it should be called something like mysql-connector-java--bin.jar).
Click on the jar file and click Select.
Click OK.
The library will be defined, and it will be in the Selected Libraries list.
You probably don't want that library to be defined in all your projects, so shuttle it over to the Available Libraries list.
this link help me a lot :
Oracle JDeveloper 11g with MySQL