Dapper not closing connection - aspnet core/OracleGet list of all tables in Oracle?How do I limit the number of rows returned by an Oracle query after ordering?Difference between a user and a schema in Oracle?Performing Inserts and Updates with DapperIs there a way to call a stored procedure with Dapper?Correct use of Multimapping in DapperSELECT * FROM X WHERE id IN (…) with Dapper ORMUsing the “per-request” approach with StructureMap and IDbConnection - the connection is opened but is closed when executedUsing Dapper QueryMultiple in OracleDapper async query inside using statement requires an open and available Connection

Best way to store options for panels

Student evaluations of teaching assistants

Implement the Thanos sorting algorithm

Is it okay / does it make sense for another player to join a running game of Munchkin?

Hide Select Output from T-SQL

Can a monster with multiattack use this ability if they are missing a limb?

Was the picture area of a CRT a parallelogram (instead of a true rectangle)?

Is there any reason not to eat food that's been dropped on the surface of the moon?

Why "be dealt cards" rather than "be dealing cards"?

Mapping a list into a phase plot

What to do with wrong results in talks?

Why Were Madagascar and New Zealand Discovered So Late?

Personal Teleportation as a Weapon

Displaying the order of the columns of a table

Cynical novel that describes an America ruled by the media, arms manufacturers, and ethnic figureheads

Was Spock the First Vulcan in Starfleet?

Failed to fetch jessie backports repository

Valid Badminton Score?

Where in the Bible does the greeting ("Dominus Vobiscum") used at Mass come from?

Why is delta-v is the most useful quantity for planning space travel?

Is there a problem with hiding "forgot password" until it's needed?

What is difference between behavior and behaviour

Minimal reference content

What would happen if the UK refused to take part in EU Parliamentary elections?



Dapper not closing connection - aspnet core/Oracle


Get list of all tables in Oracle?How do I limit the number of rows returned by an Oracle query after ordering?Difference between a user and a schema in Oracle?Performing Inserts and Updates with DapperIs there a way to call a stored procedure with Dapper?Correct use of Multimapping in DapperSELECT * FROM X WHERE id IN (…) with Dapper ORMUsing the “per-request” approach with StructureMap and IDbConnection - the connection is opened but is closed when executedUsing Dapper QueryMultiple in OracleDapper async query inside using statement requires an open and available Connection













0















I'm making some tests with Dapper, but there is a strange error.



Even with "using" statement, if I don't call the database for some time, e.g. 5 min, the next call gives me a "not logged on", the next call works.



I have created a scheduler that calls the DB every minute and had no error, if I did the same, every 5 minutes, it gives me the error.



I think that the connections is still open in the pool, even if I call an "open" , "close" connection and "using".



The connection's creation:



protected IDbConnection Connection

get

var oc = new OracleConnection(DatabaseConfig.ConnectionString);
oc.Open();
return oc;




the method:



public async Task<List<ItemLista>> GetItemListaAsync(int idLista)

using (var connection = Connection)

string nomeProcedure = "GC.PCK_ECOM_LISTA_PRESENTE.ILC_LER";

var parameters = new OracleDynamicParameters();
parameters.Add("E_TX_GC", dbType: OracleDbType.NVarchar2, size: 4000, direction: ParameterDirection.Output);
parameters.Add("E_TX_TS", dbType: OracleDbType.NVarchar2, size: 4000, direction: ParameterDirection.Output);
parameters.Add("P_ID_LISTA_LIC", dbType: OracleDbType.Decimal, value: idLista);
parameters.Add("R_REF_CUR_ILC", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output);

var result = await connection.QueryAsync<ItemLista>(nomeProcedure, parameters, commandType: CommandType.StoredProcedure);
//this connection.close changes nothing
connection.Close();
return result.AsList();




Asp.net-core 2.2



Dapper 1.50.5 (can't use 1.60.1 cause I'm using Dapper.fluentMap, and it's not compatible yet)



Oracle.ManagedDataAccess.Core 2.18.3










share|improve this question


























    0















    I'm making some tests with Dapper, but there is a strange error.



    Even with "using" statement, if I don't call the database for some time, e.g. 5 min, the next call gives me a "not logged on", the next call works.



    I have created a scheduler that calls the DB every minute and had no error, if I did the same, every 5 minutes, it gives me the error.



    I think that the connections is still open in the pool, even if I call an "open" , "close" connection and "using".



    The connection's creation:



    protected IDbConnection Connection

    get

    var oc = new OracleConnection(DatabaseConfig.ConnectionString);
    oc.Open();
    return oc;




    the method:



    public async Task<List<ItemLista>> GetItemListaAsync(int idLista)

    using (var connection = Connection)

    string nomeProcedure = "GC.PCK_ECOM_LISTA_PRESENTE.ILC_LER";

    var parameters = new OracleDynamicParameters();
    parameters.Add("E_TX_GC", dbType: OracleDbType.NVarchar2, size: 4000, direction: ParameterDirection.Output);
    parameters.Add("E_TX_TS", dbType: OracleDbType.NVarchar2, size: 4000, direction: ParameterDirection.Output);
    parameters.Add("P_ID_LISTA_LIC", dbType: OracleDbType.Decimal, value: idLista);
    parameters.Add("R_REF_CUR_ILC", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output);

    var result = await connection.QueryAsync<ItemLista>(nomeProcedure, parameters, commandType: CommandType.StoredProcedure);
    //this connection.close changes nothing
    connection.Close();
    return result.AsList();




    Asp.net-core 2.2



    Dapper 1.50.5 (can't use 1.60.1 cause I'm using Dapper.fluentMap, and it's not compatible yet)



    Oracle.ManagedDataAccess.Core 2.18.3










    share|improve this question
























      0












      0








      0








      I'm making some tests with Dapper, but there is a strange error.



      Even with "using" statement, if I don't call the database for some time, e.g. 5 min, the next call gives me a "not logged on", the next call works.



      I have created a scheduler that calls the DB every minute and had no error, if I did the same, every 5 minutes, it gives me the error.



      I think that the connections is still open in the pool, even if I call an "open" , "close" connection and "using".



      The connection's creation:



      protected IDbConnection Connection

      get

      var oc = new OracleConnection(DatabaseConfig.ConnectionString);
      oc.Open();
      return oc;




      the method:



      public async Task<List<ItemLista>> GetItemListaAsync(int idLista)

      using (var connection = Connection)

      string nomeProcedure = "GC.PCK_ECOM_LISTA_PRESENTE.ILC_LER";

      var parameters = new OracleDynamicParameters();
      parameters.Add("E_TX_GC", dbType: OracleDbType.NVarchar2, size: 4000, direction: ParameterDirection.Output);
      parameters.Add("E_TX_TS", dbType: OracleDbType.NVarchar2, size: 4000, direction: ParameterDirection.Output);
      parameters.Add("P_ID_LISTA_LIC", dbType: OracleDbType.Decimal, value: idLista);
      parameters.Add("R_REF_CUR_ILC", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output);

      var result = await connection.QueryAsync<ItemLista>(nomeProcedure, parameters, commandType: CommandType.StoredProcedure);
      //this connection.close changes nothing
      connection.Close();
      return result.AsList();




      Asp.net-core 2.2



      Dapper 1.50.5 (can't use 1.60.1 cause I'm using Dapper.fluentMap, and it's not compatible yet)



      Oracle.ManagedDataAccess.Core 2.18.3










      share|improve this question














      I'm making some tests with Dapper, but there is a strange error.



      Even with "using" statement, if I don't call the database for some time, e.g. 5 min, the next call gives me a "not logged on", the next call works.



      I have created a scheduler that calls the DB every minute and had no error, if I did the same, every 5 minutes, it gives me the error.



      I think that the connections is still open in the pool, even if I call an "open" , "close" connection and "using".



      The connection's creation:



      protected IDbConnection Connection

      get

      var oc = new OracleConnection(DatabaseConfig.ConnectionString);
      oc.Open();
      return oc;




      the method:



      public async Task<List<ItemLista>> GetItemListaAsync(int idLista)

      using (var connection = Connection)

      string nomeProcedure = "GC.PCK_ECOM_LISTA_PRESENTE.ILC_LER";

      var parameters = new OracleDynamicParameters();
      parameters.Add("E_TX_GC", dbType: OracleDbType.NVarchar2, size: 4000, direction: ParameterDirection.Output);
      parameters.Add("E_TX_TS", dbType: OracleDbType.NVarchar2, size: 4000, direction: ParameterDirection.Output);
      parameters.Add("P_ID_LISTA_LIC", dbType: OracleDbType.Decimal, value: idLista);
      parameters.Add("R_REF_CUR_ILC", dbType: OracleDbType.RefCursor, direction: ParameterDirection.Output);

      var result = await connection.QueryAsync<ItemLista>(nomeProcedure, parameters, commandType: CommandType.StoredProcedure);
      //this connection.close changes nothing
      connection.Close();
      return result.AsList();




      Asp.net-core 2.2



      Dapper 1.50.5 (can't use 1.60.1 cause I'm using Dapper.fluentMap, and it's not compatible yet)



      Oracle.ManagedDataAccess.Core 2.18.3







      oracle asp.net-core dapper






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 7 at 11:45









      William BorgoWilliam Borgo

      708




      708






















          1 Answer
          1






          active

          oldest

          votes


















          0














          The problem was in the Oracle Database.
          The user that I had used was in a profile with exactly 5 min of idle max time.



          So, the solution is to configure the Oracle pool "connection timeout" less than database's profile max idle time.



          https://docs.oracle.com/cd/B19306_01/win.102/b14307/featConnecting.htm






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55043019%2fdapper-not-closing-connection-aspnet-core-oracle%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            The problem was in the Oracle Database.
            The user that I had used was in a profile with exactly 5 min of idle max time.



            So, the solution is to configure the Oracle pool "connection timeout" less than database's profile max idle time.



            https://docs.oracle.com/cd/B19306_01/win.102/b14307/featConnecting.htm






            share|improve this answer



























              0














              The problem was in the Oracle Database.
              The user that I had used was in a profile with exactly 5 min of idle max time.



              So, the solution is to configure the Oracle pool "connection timeout" less than database's profile max idle time.



              https://docs.oracle.com/cd/B19306_01/win.102/b14307/featConnecting.htm






              share|improve this answer

























                0












                0








                0







                The problem was in the Oracle Database.
                The user that I had used was in a profile with exactly 5 min of idle max time.



                So, the solution is to configure the Oracle pool "connection timeout" less than database's profile max idle time.



                https://docs.oracle.com/cd/B19306_01/win.102/b14307/featConnecting.htm






                share|improve this answer













                The problem was in the Oracle Database.
                The user that I had used was in a profile with exactly 5 min of idle max time.



                So, the solution is to configure the Oracle pool "connection timeout" less than database's profile max idle time.



                https://docs.oracle.com/cd/B19306_01/win.102/b14307/featConnecting.htm







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 8 at 14:41









                William BorgoWilliam Borgo

                708




                708





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55043019%2fdapper-not-closing-connection-aspnet-core-oracle%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

                    Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

                    Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved