erlangbureau/jamdb_oracle

I can not connect

braulio opened this issue · 6 comments

Hello!
I can not connect. I'm using Ecto with Jamdb. I always get the error message below;

[error] Jamdb.Oracle (#PID<0.605.0>) failed to connect: ** (DBConnection.ConnectionError) {:socket, :closed}
[error] Jamdb.Oracle (#PID<0.599.0>) failed to connect: ** (DBConnection.ConnectionError) {:socket, :closed}
[error] Jamdb.Oracle (#PID<0.602.0>) failed to connect: ** (DBConnection.ConnectionError) {:socket, :closed}
[error] Jamdb.Oracle (#PID<0.614.0>) failed to connect: ** (DBConnection.ConnectionError) {:socket, :closed}
[error] Jamdb.Oracle (#PID<0.608.0>) failed to connect: ** (DBConnection.ConnectionError) {:socket, :closed}

What could be happening?

Thx.

Check IP , PORT, SID or Service Name once more.
Use Wireshark with filter TNS to check network packets.
Also try patch from this reply.

we checked everything and it's correct: IP, PORT etc. The only thing different is the database name:

database: "THCI.br1.ocm.s066055.oraclecloudatcustomer.com"

Thx.

Maybe listener makes redirection to different ip/name and port.

Try to capture packets with Wireshark.
For tcpdump use options -s 0 -w ooo.pcap :) #42

See: "THCI.br1.ocm.s066055.oraclecloudatcustomer.com" is the name of the database.

See the TNSNAMES used by sqldeveloper:

(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.1.191)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.1.191)(PORT = 1521))
)
(CONNECT_DATE =
(SERVER = DEDICATED)
(SERVICE_NAME = THCI.br1.ocm.s066055.oraclecloudatcustomer.com)
(FAILOVER_MODE =
(TYPE = select)
(METHOD = basic)
)
)
)

With sqldeveloper, everything works normally.

Sorry, I got it.

...
hostname: "10.10.1.191",
...

Try gen_tcp:connect("10.10.1.191", 1521, []).

Modify jamdb_oracle_tns_decoder.erl to print packets.

decode_packet(<<PacketSize:16, _PacketFlags:16, ?TNS_DATA, _Flags:8, 0:16, _DataFlags:16, Rest/bits>> = Data, Length) ->
    io:format("~ts~n", [Data]),
...

decode_packet(<<_PacketSize:16, _PacketFlags:16, ?TNS_REDIRECT, _Flags:8, 0:16, _Length:16, Rest/bits>> = Data, Length) ->
    io:format("~ts~n", [Data]),
...

decode_packet(<<PacketSize:16, _PacketFlags:16, Type, _Flags:8, 0:16, Rest/bits>> = Data, _Length) ->
    io:format("~ts~n", [Data]),
...