K2InformaticsGmbH / erloci

Erlang Oracle native driver - DEPRECATED, see https://github.com/K2InformaticsGmbH/oranif instead
Apache License 2.0
37 stars 11 forks source link

One failed query can prevent future queries working #71

Open acautin opened 5 years ago

acautin commented 5 years ago

From https://github.com/K2InformaticsGmbH/dderl/issues/517

Tested with:

OciPort = erloci:new([{logging, true}, {env, [{"NLS_LANG", "GERMAN_SWITZERLAND.AL32UTF8"}]}]).
OciSession = OciPort:get_session(<<"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=XXXXXXXX)(PORT=XXXXXXXX)))(CONNECT_DATA=(SERVICE_NAME=XE)))">>, <<"XXXXXXXX">>, <<"XXXXXXXX">>).
Select = <<"select SCOTT.NUMBER_LONG.*, SCOTT.NUMBER_LONG.ROWID from SCOTT.NUMBER_LONG">>,
Stmt = OciSession:prep_sql(Select).
Stmt:exec_stmt().

Produces the output:

    (sbsgui@127.0.0.1)3> OciPort = erloci:new([{logging, true}, {env, [{"NLS_LANG", "GERMAN_SWITZERLAND.AL32UTF8"}]}]).
    15.10.2018 14:25:23.992034 [debug] [_OCI_] {oci_logger,,71} ---- ERLOCI PORT PROCESS LOGGER ----
    15.10.2018 14:25:23.995507 [debug] [_OCI_] {oci_port,,292} DYLD_LIBRARY_PATH = .../Users/agustin/Documents/oracle/instantclient_11_2
    15.10.2018 14:25:23.995768 [debug] [_OCI_] {oci_port,,300} Extra Env :[{"NLS_LANG","GERMAN_SWITZERLAND.AL32UTF8"}]
    15.10.2018 14:25:23.995890 [debug] [_OCI_] {oci_port,,310} Executable "_build/default/lib/erloci/priv/ocierl"
    15.10.2018 14:25:23.995988 [debug] [_OCI_] {oci_port,,311} Options :[{packet,4},
            binary,exit_status,use_stdio,
            {args,["262144","true","54930"]},
            {env,[{"DYLD_LIBRARY_PATH",
                    "/Users/agustin/Documents/oracle/instantclient_11_2"},
                    {"NLS_LANG","GERMAN_SWITZERLAND.AL32UTF8"}]}]
    15.10.2018 14:25:23.996786 [debug] [_OCI_] {oci_port,,321} started log enabled new port:
    [{name,"_build/default/lib/erloci/priv/ocierl"},
    {links,[<0.28905.0>]},
    {id,9183},
    {connected,<0.28905.0>},
    {input,0},
    {output,19},
    {os_pid,57871}]
    15.10.2018 14:25:23.997011 [debug] [_OCI_] {oci_logger,,116} 15.10.2018 14:25:23.996967 Waiting for peer to connect on 54930
    15.10.2018 14:25:24.018012 [debug] [_OCI_] {oci_logger,,124} 15.10.2018 14:25:24.017937 Connection from 54931 to 54930
    15.10.2018 14:25:24.018248 [info] [_OCI_] {c_src/erloci_drv/erloci.cpp,main,83} [57871] Port process configs : erlang term max size 0x00040000 bytes, logging enabled, TCP port for logs 54930, NLS_LANG GERMAN_SWITZERLAND.AL32UTF
    {oci_port,<0.28905.0>}
    15.10.2018 14:25:24.018451 [debug] [_OCI_] {c_src/erloci_drv/threads.cpp,threads,39} Initializing Thread pool..
    (sbsgui@127.0.0.1)4> OciSession = OciPort:get_session(<<"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=XXXXXXXX)(PORT=XXXXXXXX)))(CONNECT_DATA=(SERVICE_NAME=XE)))">>, <<XXXXXXXX>>, <<XXXXXXXX>>).
    15.10.2018 14:25:24.034922 [info] [_OCI_] {c_src/erloci_lib/ocisession.cpp,config,69} OCI Initialize
    15.10.2018 14:25:24.089419 [info] [_OCI_] {c_src/erloci_drv/command.cpp,change_log_flag,54} Enabled logging..
    15.10.2018 14:25:24.090126 [info] [_OCI_] {oci_port,,429} Remote log_enabled
    15.10.2018 14:25:24.090441 [debug] [_OCI_] {oci_port,,369} no reply for log_enabled
    {oci_port,<0.28905.0>,140675075038352}
    15.10.2018 14:25:24.127040 [info] [_OCI_] {c_src/erloci_lib/ocisession.cpp,ocisession,128} got session 0x7ff179031338 (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.43)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=XE))) user scott
    (sbsgui@127.0.0.1)5> Select = <<"select SCOTT.NUMBER_LONG.*, SCOTT.NUMBER_LONG.ROWID from SCOTT.NUMBER_LONG">>,
    (sbsgui@127.0.0.1)5> Stmt = OciSession:prep_sql(Select).
    {oci_port,statement,<0.28905.0>,140675075038352,
            140675073984544}
    (sbsgui@127.0.0.1)6> Stmt:exec_stmt().
    15.10.2018 14:25:25.423975 [error] [_OCI_] {c_src/erloci_lib/ocistmt.cpp,execute,707} Unsupported column type 8
    {error,{0,<<"[execute:706] unsupporetd type 8\n">>}}
    15.10.2018 14:25:25.424772 [debug] [_OCI_] {c_src/erloci_drv/threads.cpp,~threads,85} Cleanup Thread pool..
    {oci_logger,108} TCP closed
    {oci_logger,137} Terminating normal
    (sbsgui@127.0.0.1)7> OciSession:prep_sql(Select).
    ** exception exit: {noproc,
                        {gen_server,call,
                            [<0.28905.0>,
                                {port_call,
                                    [4,140675075038352,
                                    <<"select SCOTT.NUMBER_LONG.*, SCOTT.NUMBER_LONG.ROWID from SCOTT.NUMBE"...>>]},
                                infinity]}}
        in function  gen_server:call/3 (gen_server.erl, line 214)
        in call from oci_port:prep_sql/2 (/Users/agustin/Documents/k2_informatics/sbsgui/_build/default/lib/erloci/src/oci_port.erl, line 139)
    (sbsgui@127.0.0.1)8> 14:26:03.259 [info] [_DDRL_] {dderl_session,159} session {<0.28862.0>,<<>>} idle for 90000 ms
    14:26:03.259 [info] [_DDRL_] {dderl_session,195} dderl_session {<0.28862.0>,<<>>} terminating, reason normal