Try to search your question here, if you can't find : Ask Any Question Now ?

Executing several INSERT clauses into a SQLServer database causes broken pipe

HomeCategory: stackoverflowExecuting several INSERT clauses into a SQLServer database causes broken pipe
pragati asked 2 weeks ago

The following code I have is running on a server where Java client executes it by simply calling a command “py scriptname.py”. There is a very specific usecase where this script crashes, which is giving me a headache debugging.

This script works perfectly well during any other time except during early monday when ran very first time. My primary suspection is that the database where it is executing these is somehow “a sleep” after the weekend and this causes the crash. If this code is ran minute later by hand simply executing the same command “py scriptname.py”, then everything works ok.

However this leads me to believe there is a fundamental problem in the code. The code causing the error is this:

for row in self.cursorLocal.fetchall():
        sqlName = "INSERT INTO TABLE ATTRIBUTE1, ATTRIBUTE2 VALUES('{}','{}')".format(row[1],row[2])
        print(sqlName) # <-- line 321
        self.cursorName.execute(sqlName)
        self.conName.commit()

Exception:
[Errno 32] Broken pipe

Traceback: 
Traceback (most recent call last): File "C:folderscriptname.py", line 88, in __init__ self.InsertTo() File "C:folderscriptname.py", line 321, in InsertTo print(sqlName) BrokenPipeError: [Errno 32] Broken pipe 

I have tried a lot of different scenarios trying to replicate this in my local environment, but without any luck. However this same error constantly occurs every monday morning.

1 Answers
Best Answer
Matthias answered 2 weeks ago
Your Answer

17 + 15 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com