Making simple database in Squirrel SQL - squirrel-sql

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>]

Related

Connect to MySQL database and fetch data in Julia

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.

extract and load from mysql DB to another

I would like to extract and load data from mysql DB to another mysql DB without shutting down mysql in the process.
Tried to use the open source Talend community edition.
Used mysql input component, filled connection details which were tested to work.
Component could not connect to mysql and got the error:
Exception in component tMysqlOutput_1
java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
though I added to eclipse project the jar: mysql-connector-java-5.0.8.jar
The mysql components in talend should absolutely work out of the box without the need to load any additional drivers. I'd say reinstall talend because something else is wrong.
To manually load your mysql connector, you can use the tLibraryLoad component.
Choose the jar file from the dropdown in the "Basic Settings". It should be there if it's been included in the project.
You can also pick a lib path in the component's advanced settings and add the import line below that.
Again, you certainly shouldn't need to do this for the mysql component. Talend comes with the drivers to connect to all databases that have components.
In fact I've copied those drivers to other programs that didn't come with them.
Good luck!

connect R to MySQL with RODBC using dsn

Short version: I'm trying to figure out how to use the dsn argument in the odbcConnect() function to connect to a MySQL database.
Longer version: I appologize if this is an ignorant question. I didn't find an answer on SO searching under the tags. I'm not new to R, although I'm not the world's foremost expert. I am new to MySQL. I have been trying to learn it on my own.
I would like to be able to create tables and such in R and write them to a database in MySQL and then be able to select from them later and read the selected records back into R for analysis. I can create a database in MySQL, select, export a text file, & read that file into R now, but I would rather be able to do everything from R. For this purpose, I installed RODBC to be able to connect R to MySQL directly. I understand that I need to use the odbcConnect() function, but I do not understand what to put for the dsn argument to do this, and haven't been able to figure it out from the wiki or the help file.
Details (if needed):
I did not establish a uid or password when I set up MySQL
Versions used: Windows XP; R 2.10.1; MySQL 5.5
Locations of exe files: C:\Program Files\MySQL\MySQL Server 5.5\bin
C:\Program Files\R\R-2.10.1\bin
I expect I need fairly basic advice--e.g., it might be best to assume I don't even know what dsn stands for (even though that's not actually true). Any help is appreciated. Thanks in advance.
The simplest solution I can suggest would be installing RMySQL. This will give you native connectivity to the MySQL database that you are using.
If you want to use ODBC besides needing to have the MySQL ODBC drivers you will need to set up the ODBC connection in the ODBC manager on Windows XP. When you go through the connection it will ask you for a name, which will be your DSN name, which then you should be able to use in odbcConnect()

How to Create DSN in ubuntu

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.

How do I setup my MySQL with Eclipse IDE?

I am using Eclipse EE IDE and I am using the MySql Connector/J driver. How do I set up a properties file with all the information(DB URL, DBusername,etc) Also I see that you need a DBname and DBurl for the properties file, How do I determine/create this name for the database. I have already looked at the mysql website for this and am still having trouble, if somebody could pleasee help me I would appreciate it.
Solution: I was able to get it working through the plugin available with Eclipse, but I soon realized this limited me with the use of my Tomcat server, so I re organized my directories and set up Tomcat to use with my Eclipse and also be available to other resources.
Eclipse doesn't use a database for anything, so even if you would create a properties file, it would ignore it.
If you're using the DB plugin, then you can use the UI to create a connection for the database. The wizard will ask for all the informations and save them somewhere (probably not as a property file).
If you need the database in your own project, then you must define the format of the property file yourself, read it at startup, and use the information to create a datasource.
You should use phpMyAdmin, or MySQL GUI tools for MySQL setup and management