I want to create a DSN in Ubuntu Linux 10.10 for a Java application with a MySQL back end.
Sorry if the question is simple but I really need your help.
How can I create it? What are the drivers that are needed to install for the same?
JDBC is the way to go to get database connectivity in a Java application.
You'll need to install a JDBC driver for MySQL, e. g. Connector/J. Installation and usage of Connector/J is documented in the MySQL reference manual.
The format of a connection URL for Connector/J is specifically described in 20.3.4.1. Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J.
Related
Perhaps it's a silly question, but at least for me is not that obvious. Perhaps for the naming.
I'm trying to figure out what is the correct package I'm need to use to connect my R code to a MySQL database.
I've read in the RMySQL package that:
NOTE: this package is being phased out in favor of the new RMariaDB package.
So in other words, from now on do I need to use RMariaDB package even if I'm connecting to MySQL or MySQL support is going to be dropped at some point since the databases are diverging a little bit on each version.
I specially ask in the context of MySQL 8.
Thanks!
Yes, you should use RMariaDB instead of RMySQL.
Both RMariaDB and RMySQL are using the same database driver, the MariaDB Connector/C client library for client/server communication:
MariaDB Connector/C supports all MySQL and MariaDB specific authentication methods, so connecting to a MySQL 8.0 database server shouldn't be a problem.
Beside the X-Protocol, which isn't used in R, MariaDB Connector/C also supports all MySQL specific api features.
RMariaDB supports text and binary protocol for client/server communication. Differences between MySQL and MariaDB binary protocol are handled in MariaDB Connector/C, text protocol is still the same.
RMariaDB will be a replacement for RMySQL, so in near future you will not get bug or security fixes for RMySQL anymore.
I tried connecting the database from the server, but MySQL Workbench says that the connection cannot be made and declaring it as Bad Handshake. Can someone help me with this? But if I use the same user id and password and DB connections, it works on the other computer systems. Can someone solve this issue?
The authentication has changed from mysql V8, you must use a compatible client and server.
BTW it's a bug : https://bugs.mysql.com/bug.php?id=91828
Here is a workaround without uninstalling the new workbench.
The most probable case is having an old server with a new workbench:
get the server version
From a SQL cli tool:
SHOW VARIABLES LIKE "%version%";
or from a cli connected on the server:
$ mysql -v
It should show a version < 8.0, in my case 5.1.73
Get the mysqlWorkbench for a version <8.0:
You cannot install the msi if you already have a workbench V8.0, so you have to choose a portable installation form a zip file here:
https://dev.mysql.com/downloads/workbench/6.1.html
Select the version 6.2.5 (last before v8.0) zip version
Unzip
Close the workbench v.8 (it lock any other workbench launch)
Launch the V6.2.3 version of workbench, it should works.
This is probably because of a mismatch in the versions of MySQL servers.
Check the version of the MySQL server you are trying to connect to, and the version you have installed on the computer you are using, they have to be the same.
The reason of this warning is version problem. If you have installed mysql server version <= 5.1 and your remote server mysql version is greater than that you will face this problem. I recommend you to install 5.7 or greater in both your local and remote server. This problem will be fixed.
Fortunately there is an easy way around this. Use the old MYSQL ADMINISTRATOR tool as shown below. In my case I was trying to open a MySQL 5.1 database for a clients WordPress installation with MySQL Workbench 8 and that did not work out :).
ALl credits goes to https://www.urtech.ca/2019/01/solved-bad-handshake-mysql-workbench-failed-to-connect-to-sql/
Follow this link for the details
https://www.urtech.ca/2019/01/solved-bad-handshake-mysql-workbench-failed-to-connect-to-sql/
When using DataGrip to connect to MySQL, there is a connection error. I know it can be solved by modify MySQL server configuration, but is there a client way?
[HY000][1193] Unknown system variable 'query_cache_type'
Are you using MySQL 8.0.3? The new version has removed support for the query cache (for good reason), and the variables that pertain to it.
https://dev.mysql.com/doc/refman/5.7/en/query-cache.html says:
Note
The query cache is deprecated as of MySQL 5.7.20, and is removed in MySQL 8.0.
I just installed the latest DataGrip 2017.2.2 and the latest MySQL 8.0.3-RC and I can reproduce the error you report. I was able to use DataGrip fine with MySQL 8.0.1.
I have logged a bug with DataGrip: https://youtrack.jetbrains.com/issue/DBE-5212
Update: the JetBrains bug report referred me to this MySQL JDBC driver bug: https://bugs.mysql.com/bug.php?id=87846
TL;DR:
You need to use Connector/J 5.1.44 to connect to MySQL 8.0.3.
I followed these steps:
Download the free MySQL Connector/J 5.1.44 from https://dev.mysql.com/downloads/connector/
Open DataGrip's Data Sources inspector with Cmd-;
Select the MySQL driver
Uncheck the use of the bundles MySQL Connector/J
Click "+" to add a file, and select the MySQL Connector/J jar that I had downloaded
Restart DataGrip
Once I had done that, queries in DataGrip work against MySQL 8.0.3.
I changed the driver to MariaDB and that works for me.
Changing to the last version of MySQL didn't help.
How can I fetch data from MySQL database in Julia?
It looks like this package provides tools for connecting to any database, including MySQL. However, it looks like assuming I have to first setup ODBC DSN to connect to it (I don't know what it is in the first place, although I've used MySQL for two years). So I tried to configure it by reading this page at MySQL documentation... but hit the wall immediately.
One, I can't find a command named myodbc-installer in my OS X 10.8.5. Two, there is no such application called ODBC Administrator, and instead there is ODBC manager in my system - So I think that documentation is too outdated... right?
Also, even when I opened ODBC manager and tried to click on Add on User DSN tab, there are no driver detected on the screen. So how can I configure ODBC DSN and make use of MySQL in Julia?
Also, do I have to deal with such a tedious setup process? I'd like to use a package, if any, that is as intuitive and easy to use as RMySQL package in R, which doesn't force me to care about DSN - any such package in Julia?
I'm on 0.2.0-rc in Julia and already installed the package through Pkg.add("ODBC"). MySQL version is 5.3.6 and installed via MAMP.
Thanks.
Jacob Quinn here, package maintainer for the ODBC package for Julia.
A few things to help you understand how the process works:
-ODBC is an API middle layer originally developed by Microsoft to create a common interface between DB systems and applications. This was useful because with the number of different DB systems, it would be hard to have applications that could reliably connect to any DB.
-ODBC has been ported to Linux/Unix/OSX systems through 2 main projects: iodbc (mainly OSX) and unixODBC (Linux)
-The basic components of the API are the ODBC Manager, which is the middle layer, the DB system, the application, and the ODBC driver, which is DB-specific and actually implements the communication between application-ODBC Manager and ODBC Manager-DB system.
-In the case of RMySQL, only the MySQL driver has been implemented with R wrapper functions which allow the connection to MySQL DB systems
-In the case of ODBC.jl (and the corresponding RODBC for R), a more generalized approach is taken where wrapper functions of the ODBC Manager are provided, which allow connection with any DB system, provided the user has the correct DB driver installed and connection string
Hopefully that helps understand the ODBC process a little better.
So for your case, it looks like you don't have the MySQL driver installed since it didn't show up in your ODBC Manager. You can find the driver here.
Once you have the driver installed, it should be pretty simple to set up a DSN (following either MySQL documentation or the excellent connectionstrings.com, MySQL Section).
You should then be able to start using ODBC in julia:
Pkg.add("ODBC")
using ODBC
ODBC.connect(dsn)
query("select * from customers")
If you run into any other issues or troubles getting things setup or installed, feel free to open an issue here and I'm more than willing to help troubleshoot the setup to get you going.
I am trying to make a simple java application that connects to database in Squirrel SQL which I use JDBC connector to connect to but I can't seem to pass making the database in Squirrel. I have my jdbc jar file in place as there is a blue tick indicating my driver is available but but I am not where I might be going wrong. Your shed of insight is highly appreciated. Thank you in advance. Below are pictures of what my setup looks like
Your database is a MySQL one. Instead of "jdbc" driver, use a MySQL one.
It is "MySQL Driver" in the Drivers menu. attach your jar file and then in the Aliases definition, use the MySQL Driver you just configured.
You should either use (or modify) a pre-existing RDBMS driver for MySQL or make your own and label it as a MySQL driver.
The key piece of information that may be missing is the qualified path to your RDBMS home directory. Squirrel needs to be able to find the jar file that contains the JDBC driver for the RDBMS product that you'll be using.
While I haven't set up Squirrel for MySQL, I have set it up for HSQLDB. In the "Extra Class Path" tab of the change driver dialog, I have added and entered the path to my hsqldb.jar file:
C:\App\Dev\Java\DB\hsqldb\2.2.9\lib\hsqldb.jar
This enables the service provider in the JDBC driver package to locate and load the particular JDBC driver for HSQLDB.
Just as a side note, every RDBMS has its own semantics for the connection URL. The one for HSQLDB is unique to it. The one for MySQL (according to the folks at SquirrelSQL) is:
jdbc:mysql://<hostname>[,<failoverhost>][<:3306>]/
<dbname>[?<param1>=<value1>][&<param2>=<value2>]