Octo.jl icon indicating copy to clipboard operation
Octo.jl copied to clipboard

Can't connect to database

Open Dunckleosteus opened this issue 2 years ago • 2 comments

Hello I am a novice so this may seem obvious but when I try to connect to a local postgres database using the following code:

Repo.connect(
    adapter = Octo.Adapters.PostgreSQL,
    dbname = "postgis",
    user = "postgres"
)

I get the following error:

MethodError: no method matching getpass(::Base.DevNull, ::IOContext{Base.PipeEndpoint}, ::String)

Closest candidates are:

getpass(!Matched::Base.TTY, ::IO, ::AbstractString) at util.jl:261

getpass(::String)@util.jl:291
var"#Connection#17"(::Bool, ::Int64, ::Dict{String, String}, ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::Type{LibPQ.Connection}, ::String)@connections.jl:309
[email protected]:265[inlined]
var"#db_connect#1"(::Base.Pairs{Symbol, String, Tuple{Symbol, Symbol}, NamedTuple{(:dbname, :user), Tuple{String, String}}}, ::typeof(Main.PostgreSQLLoader.db_connect))@PostgreSQL.jl:19
var"#invokelatest#2"(::Base.Pairs{Symbol, String, Tuple{Symbol, Symbol}, NamedTuple{(:dbname, :user), Tuple{String, String}}}, ::typeof(Base.invokelatest), ::Any)@essentials.jl:731
var"#connect#1"(::Module, ::Nothing, ::Bool, ::Base.Pairs{Symbol, String, Tuple{Symbol, Symbol}, NamedTuple{(:dbname, :user), Tuple{String, String}}}, ::typeof(Octo.Repo.connect))@Repo.jl:83
top-level scope@[Local: 1](http://localhost:1234/edit?id=c37d6530-e4d7-11ed-2220-d3f608429ebb#)[inlined]
```sql

All the dependencies should be installed.

Dunckleosteus avatar Apr 27 '23 09:04 Dunckleosteus

Solved the problem, I forgot to specify the password. Here is the update code in case anyone makes the mistake: Repo.connect( adapter = Octo.Adapters.PostgreSQL, dbname = "postgis", user = "postgres", password="password" )

Dunckleosteus avatar Apr 27 '23 10:04 Dunckleosteus

good!

wookay avatar Apr 27 '23 15:04 wookay