Reputation: 938
I am new to Julia having used R for the last few years and I am struggling with my first task which is connecting to my AWS MySQL database.
I have followed many online tutorials but I get the same message no matter what I do.
Everything was installed yesterday so it should all be the current version.
julia-version = Version 1.5.2
Here is the code:
Pkg.add(PackageSpec(url="https://github.com/JuliaComputing/MySQL.jl"))
Pkg.add(PackageSpec(url="https://github.com/JuliaDB/DBI.jl"))
using MySQL
con = MySQL.connect("ec2blah.eu-west-2.compute.amazonaws.com", "name", "password", db = "database")
When I run this I get the following error:
UndefVarError: connect not defined
getproperty(::Module, ::Symbol) at Base.jl:26
top-level scope at data_prep.jl:18
Thanks
Upvotes: 6
Views: 1627
Reputation: 20288
As per the documentation, you should probably do something like this:
using Pkg
Pkg.add("MySQL") # No need for a full PackageSpec here
Pkg.add("DBInterface")
using MySQL
using DBInterface
conn = DBInterface.connect(MySQL.Connection, "ec2blah.eu-west-2.compute.amazonaws.com",
"name", "password", db = "database")
Upvotes: 7