Monday 17 February 2020

sql server temporary table cannot be found

jdbcTemplate.execute("sql to create #temp_table_1");

fun(){
   jdbcTemplate.execute("sql to update data in #temp_table_1")
}

Exception: Object temp_table_1 cannot be found.

This is may cause the temp_table_1 is created by connection 1, but update sql using connection 2. As local temporary table is created by one connection and cannot be found by another connection.

One solution here is using the same connection to create, retrive and update the temporary table,
Or create a global temporary table ##temp_table and then it can be found by different connection instance.

And if you using datasource and conneciton pool, normally you need to drop the temporary table emplicitely cause the connection will not be closed but returned to the pool.

1 comment:

  1. Breakup is certainly painful and no one wants to go through it. But still if you had a breakup due to any reason, you can still get your ex back, I just got my husband back through the help of genuine love spell caster called dr unity. My name is Emily Sarah am from Tx,USA. My husband left me for another woman, This was just 3 years of our marriage. The most painful thing is that I was pregnant with our second baby. I wanted him back. I did everything within my reach to bring him back but all was in vain, I wanted him back so badly because of the love I had for him, I begged him with everything, I made promises but he refused. I explained my problem to my friend and she suggested that I should rather contact a spell caster that could help me cast a spell to bring him back , I had no choice than to try it. I messaged the spell caster called dr unity, and he assured me there was no problem and that everything will be okay before 11 hours. He cast the spell and surprisingly 11 hours later my husband called me. I was so surprised, I answered the call and all he said was that he was so sorry for everything that had happened He wanted me to return to him. He also said he loved me so much. I was so happy and went to him that was how we started living together happily again.thanks to dr unity . if you are here and your Lover is turning you down, or your husband moved to another woman, do not cry anymore, contact Dr.Unity for help now..Here his contact..WhatsApp him: +2348055361568 ,
    Email him at: Unityspelltemple@gmail.com
    ,Watch this YouTube channel to know how grateful I am https://youtube.com/shorts/rBPtBktMmtA?feature=share

    ReplyDelete