Odbc ошибка function sequence error 0

The problem

During a very simple insert query, using PDO with an ODBC driver for a DB2 database, the driver returns the following error:

SQLSTATE[HY010]: Function sequence error: 0 [Microsoft][Driver Manager ODBC] [italian message translation] (SQLExecute[0] at extpdo_odbcodbc_stmt.c:254)

The query itself is a prepared statement insert, with strings and dates. [italian message translation] just says «Function sequence error» in italian.

The research

This SO question reports the same problem, but occurred during a SELECT query, which is not my case
This PHP bug report reports the same problem, but I’ve determined that’s not my case either.

The question

Why does a simple insert cause a function sequence error with SQLSTATE[HY010]?

Community's user avatar

asked Dec 3, 2014 at 10:15

STT LCU's user avatar

Reading from the PHP bug report, users have reported that the issue is related to the format of the date being inserted, because (in that particular case) it was missing some digits from the months number.

That made me think: maybe the length of some input data was incompatible with the table column. In fact, I was writing 80 characters where only 60 could fit.

The solution

Check your input values: length, format and type. One of these may be incompatible with the column you’re writing into. I’d expect a different message from the driver to be honest (data truncated in my case), because the problem isn’t too hard to solve if you have better information.

As soon as I reduced the input length below the maximum value allowed, the query executed successfully

Jared Mellentine's user avatar

answered Dec 3, 2014 at 10:15

STT LCU's user avatar

STT LCUSTT LCU

4,3384 gold badges29 silver badges47 bronze badges

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Closed

gizmo93 opened this issue

Aug 24, 2018

· 10 comments

Comments

@gizmo93

Environment

To diagnose, we usually need to know the following, including version numbers. On Windows, be
sure to specify 32-bit Python or 64-bit:

  • Python: 3.5.4 64-bit
  • pyodbc: 4.0.24
  • OS: Windows 10
  • DB: SQL Server 2017
  • driver: ODBC Driver 17 for SQL Server

Issue

Expected behavior: Insert NULL into nullable varchar/nvarchar(max) column with fast_executemany=True.
What happens: pyodbc.Error: Function sequence error (0) (SqlParamData)

Reproduction:

CREATE TABLE TestTable
(
	LongerContent NVARCHAR(MAX) NULL,
)

Works:

sql = """
INSERT INTO TestTable (LongerContent) VALUES (?)
"""

params = (
    ('ajhdiwopwqlwdlsdlpwdlowde',), (None,),
)


con = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER=server;DATABASE=db;Trusted_Connection=yes;')
cursor = con.cursor()
cursor.fast_executemany=False
cursor.executemany(sql, params)
con.commit()

Results in Function sequence error (0):

import pyodbc

sql = """
INSERT INTO TestTable (LongerContent) VALUES (?)
"""

params = (
    ('ajhdiwopwqlwdlsdlpwdlowde',), (None,),
)


con = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER=server;DATABASE=db;Trusted_Connection=yes;')
cursor = con.cursor()
cursor.fast_executemany=True
cursor.executemany(sql, params)
con.commit()

so it seems to be a problem with the fast_executemany option.

ODBC Trace:
SQL.LOG

@v-chojas

@gizmo93

Hey v-chojas,
thank you! Would it be possible to do a release including that bugfix?

@gordthompson

@v-chojas — Possibly related:

Using the current master branch and Python 3.6 the test test_executemany_dae_0 in tests3/sqlservertests.py fails under Windows (msodbcsql17.dll 17.02.0000) but does not fail under Linux (libmsodbcsql-17.2.so.0.1 17.02.0000, unixODBC 2.3.7).

Specifically, under Windows the test throws the error

Function sequence error (0) (SqlParamData)

@tigerhawkvok

@mkleehammer

FYI — I’m still seeing the function sequence error on Windows. However, a memory overwrite could certainly behave differently on different machines.

@gordthompson

@v-chojas ( cc: @v-makouz , @mkleehammer )

Further to my comment above and your comment in issue 432

When test_executemany_dae_0 in «tests3/sqlservertests.py» succeeds on Linux we see SQLExecute returning with SQL_NEED_DATA, followed by SQLParamData returning with SQL_NEED_DATA, followed by SQLPutData

Linux_ok.log, line 4120

[ODBC][1952][1537029166.431837][SQLExecute.c][187]
        Entry:
            Statement = 0x29aa270
[ODBC][1952][1537029166.432641][SQLExecute.c][357]
        Exit:[SQL_NEED_DATA]
[ODBC][1952][1537029166.432721][SQLParamData.c][166]
        Entry:
            Statement = 0x29aa270
            Value = 0x7ffef68d8fa0
[ODBC][1952][1537029166.432734][SQLParamData.c][362]
        Exit:[SQL_NEED_DATA]
            Value = 0x29ae680
[ODBC][1952][1537029166.432770][SQLPutData.c][148]
        Entry:
            Statement = 0x29aa270
            Data = 0x7f6b27b63690
            StrLen = 0
[ODBC][1952][1537029166.432784][SQLPutData.c][315]
        Exit:[SQL_SUCCESS]

However, when it fails on Windows we see SQLExecute returning with SQL_NEED_DATA, followed by SQLParamData returning with SQL_NEED_DATA, followed by another SQLParamData call …

Windows_fail.log, line 5572

sqlservertests  238c-5a8    ENTER SQLExecute 
        HSTMT               0x000000000008D740

sqlservertests  238c-5a8    EXIT  SQLExecute  with return code 99 (SQL_NEED_DATA)
        HSTMT               0x000000000008D740

sqlservertests  238c-5a8    ENTER SQLParamData 
        HSTMT               0x000000000008D740
        PTR *              0x00000000002ADDC8

sqlservertests  238c-5a8    EXIT  SQLParamData  with return code 99 (SQL_NEED_DATA)
        HSTMT               0x000000000008D740
        PTR *              0x00000000002ADDC8

sqlservertests  238c-5a8    ENTER SQLParamData 
        HSTMT               0x000000000008D740
        PTR *              0x00000000002ADDC8

sqlservertests  238c-5a8    EXIT  SQLParamData  with return code -1 (SQL_ERROR)
        HSTMT               0x000000000008D740
        PTR *              0x00000000002ADDC8

        DIAG [HY010] [Microsoft][ODBC Driver 17 for SQL Server]Function sequence error (0) 

… which is the «Function sequence error».

@v-chojas

@gordthompson Yes we are aware of the cause, and will be working on a solution to it.

@mkleehammer

This seems pretty serious, so I’m going to wait for this before making the next build.

@v-makouz

@gizmo93
I’ve made a pull request for a fix for this error. It seems that in python 3 the parameters are not bytes, but Unicode objects and to allow them to be used by SQLPutData I need to convert them into a bytes object.

Tested on Windows 10 and Ubuntu 17.04, I also ran sqlservertests.py, mysqltests.py and pgtests.py using Python 2 and 3 and didn’t see any new errors.

#467

@mkleehammer Let me know if you need me to make any further changes

@mkleehammer

Merged in fix from v-makouz in 4.0.25

When calling SQLFetch() in our application, the error status «HY010: function sequence error» is returned when using SQL Server 2008 R2. The ODBC trace log contains these entries:

otsvcctl        1954-13bc ENTER SQLGetData

  HSTMT               037BE728
  UWORD                        3

  SWORD                       -8 <SQL_C_WCHAR>
  PTR                 0x02D24E1C

  SQLLEN                   256
  SQLLEN *            0x0012BF6C

otsvcctl        1954-13bc EXIT  SQLGetData  with return code 0 (SQL_SUCCESS)
  HSTMT               037BE728
  UWORD                        3

  SWORD                       -8 <SQL_C_WCHAR>
  PTR                 0x02D24E1C [      14] «winword»
  SQLLEN                   256
  SQLLEN *            0x0012BF6C (14)

otsvcctl        1954-13bc ENTER SQLFetch

  HSTMT               037BE728

otsvcctl        1954-13bc EXIT  SQLFetch  with return code -1 (SQL_ERROR)
  HSTMT               037BE728

  DIAG [HY010] [Microsoft][SQL Server Native Client 10.0]Function sequence error (0)

If I understand
http://msdn.microsoft.com/en-us/library/ms710996(v=VS.85).aspx and
http://msdn.microsoft.com/en-us/library/ms712424(v=VS.85).aspx correctly, SQLFetch() never should return HY010 if a previous SQLGetData() succeeded on the same statement handle (because SQLGetData() causes the statement handle to remain in state S6
and SQLFetch() never can return HY010 in state S6).

Is this right, or is there any condition that could cause HY010 in this case? Are there any debugging options that I could use to determine the reason of the HY010 error?

Regards
— Frank

Is Microsoft Odbc Driver Manager Function Sequence Error (#0) appearing? Would you like to safely and quickly eliminate Microsoft Odbc Driver which additionally can lead to a blue screen of death?

When you manually edit your Windows Registry trying to take away the invalid odbc call failed function sequence error 0 keys you’re taking a authentic chance. Unless you’ve got been adequately trained and experienced you’re in danger of disabling your computer system from working at all. You could bring about irreversible injury to your whole operating system. As very little as just 1 misplaced comma can preserve your Pc from even booting every one of the way by!

Troubleshooting ms access function sequence error Windows XP, Vista, 7, 8 & 10

Simply because this chance is so higher, we hugely suggest that you make use of a trusted registry cleaner plan like CCleaner (Microsoft Gold Partner Licensed). This system will scan and then fix any Microsoft Odbc Driver Manager Function Sequence Error (#0) complications.

Registry cleaners automate the entire procedure of finding invalid registry entries and missing file references (including the Driver error) likewise as any broken hyperlinks inside of your registry.

Issue with microsoft odbc driver manager data source name not found

Backups are made immediately prior to each and every scan providing you with the choice of undoing any changes with just one click. This protects you against doable damaging your pc. Another advantage to these registry cleaners is that repaired registry errors will strengthen the speed and performance of one’s procedure drastically.

  • https://social.msdn.microsoft.com/Forums/sqlserver/en-US/86fc9d29-99ee-416e-891f-2451c4f09f4d/microsoftodbc-driver-manager-function-sequence-error-in-64bit-windows-2008-server?forum=sqldataaccess
  • http://www.utteraccess.com/forum/Function-Sequence-Error-t1799368.html
  • http://stackoverflow.com/questions/27268959/sqlstatehy010-function-sequence-error-0-during-insert
  • http://stackoverflow.com/questions/18347920/ms-oracle-odbc-driver-function-sequence-error

Cautionary Note: Yet again, for those who are not an state-of-the-art consumer it’s very encouraged that you simply refrain from editing your Windows Registry manually. If you make even the smallest error within the Registry Editor it can result in you some serious issues that may even call for a brand new set up of Windows. Not all difficulties attributable to incorrect Registry Editor use are solvable.

Fixed: microsoft odbc driver manager download

Symptoms of Microsoft Odbc Driver Manager Function Sequence Error (#0)
“Microsoft Odbc Driver Manager Function Sequence Error (#0)” appears and crashes the energetic method window.
Your Personal computer routinely crashes with Microsoft Odbc Driver Manager Function Sequence Error (#0) when running the exact same system.
“Microsoft Odbc Driver Manager Function Sequence Error (#0)” is shown.
Windows operates sluggishly and responds little by little to mouse or keyboard input.
Your computer periodically “freezes” for the number of seconds in a time.

Will cause of Microsoft Odbc Driver Manager Function Sequence Error (#0)

Corrupt obtain or incomplete set up of Windows Operating System software program.

Corruption in Windows registry from a new Windows Operating System-related application adjust (install or uninstall).

Virus or malware infection which has corrupted Windows method documents or Windows Operating System-related application data files.

Another method maliciously or mistakenly deleted Windows Operating System-related files.

Mistakes this sort of as “Microsoft Odbc Driver Manager Function Sequence Error (#0)” can be brought about by several different elements, so it really is important that you troubleshoot every of the achievable brings about to forestall it from recurring.

Simply click the beginning button.
Variety “command” inside the lookup box… Will not hit ENTER nonetheless!
Although keeping CTRL-Shift in your keyboard, hit ENTER.
You’re going to be prompted that has a authorization dialog box.
Click on Of course.
A black box will open having a blinking cursor.
Variety “regedit” and hit ENTER.
Within the Registry Editor, choose the odbc call failed function sequence error 0 connected key (eg. Windows Operating System) you wish to back again up.
Within the File menu, choose Export.
Inside the Preserve In list, pick out the folder in which you wish to save the Windows Operating System backup key.
Inside the File Title box, sort a reputation for the backup file, these types of as “Windows Operating System Backup”.
From the Export Vary box, ensure that “Selected branch” is selected.
Click on Help you save.
The file is then saved by using a .reg file extension.
You now use a backup within your ms access function sequence error related registry entry.

Solution to your microsoft odbc driver manager the specified dsn contains an architecture mismatch problem

There are actually some manual registry editing measures that can not be talked about in this article due to the high chance involved for your laptop or computer method. If you want to understand more then check out the links below.

Additional Measures:

One. Conduct a Thorough Malware Scan

There’s a probability the (#0) Manager Odbc Microsoft Driver Error Sequence Function error is relevant to some variety of walware infection. These infections are malicious and ready to corrupt or damage and possibly even delete your ActiveX Control Error files. Also, it’s attainable that your Microsoft Odbc Driver Manager Function Sequence Error (#0) is actually connected to some element of that malicious plan itself.

2. Clean microsoft odbc driver manager data source name not found and no default driver specified Disk Cleanup

The a lot more you employ your computer the extra it accumulates junk files. This comes from surfing, downloading packages, and any sort of usual computer system use. When you don’t clean the junk out occasionally and keep your program clean, it could turn into clogged and respond slowly. That is when you can encounter an Function error because of possible conflicts or from overloading your hard drive.

Once you clean up these types of files using Disk Cleanup it could not just remedy Microsoft Odbc Driver Manager Function Sequence Error (#0), but could also create a dramatic change in the computer’s efficiency.

Tip: While ‘Disk Cleanup’ is definitely an excellent built-in tool, it even now will not completely clean up Microsoft Odbc discovered on your PC. There are numerous programs like Chrome, Firefox, Microsoft Office and more, that cannot be cleaned with ‘Disk Cleanup’.

Since the Disk Cleanup on Windows has its shortcomings it is extremely encouraged that you use a specialized sort of challenging drive cleanup and privacy safety application like CCleaner. This system can clean up your full pc. If you run this plan after each day (it could be set up to run instantly) you are able to be assured that your Pc is generally clean, often operating speedy, and always absolutely free of any (#0) error associated with your temporary files.

How Disk Cleanup can help dbd microsoft odbc driver manager data source name not found and no default driver specified

1. Click your ‘Start’ Button.
2. Style ‘Command’ into your search box. (no ‘enter’ yet)
3. When holding down in your ‘CTRL-SHIFT’ important go ahead and hit ‘Enter’.
4. You will see a ‘permission dialogue’ box.
5. Click ‘Yes’
6. You will see a black box open up plus a blinking cursor.
7. Variety in ‘cleanmgr’. Hit ‘Enter’.
8. Now Disk Cleanup will start calculating the amount of occupied disk space you will be able to reclaim.
9. Now a ‘Disk Cleanup dialogue box’ seems. There will be a series of checkboxes for you personally to pick. Generally it will likely be the ‘Temporary Files’ that consider up the vast majority of your disk area.
10. Verify the boxes that you want cleaned. Click ‘OK’.

How to repair java.sql.sqlexception microsoft odbc driver manager

3. System Restore can also be a worthwhile device if you ever get stuck and just desire to get back to a time when your computer system was working ideal. It will work without affecting your pics, paperwork, or other crucial information. You can discover this option with your User interface.

Microsoft Odbc

Manufacturer

Device

Operating System


Microsoft Odbc Driver Manager Function Sequence Error (#0)


5 out of
5

based on
50 ratings.

 

Hi,

I am migrating a application from Linux to windows 8.

And the database of this application is migrated from
 Oracle 11g database to MS SQL server 2014 using SSMA.  

Schema and data are migrated successfully.

Now when I run below command from application. I get this error as shown below:

enable index Originator;

Error: #1900068: enable index failed

System Error: #1400000: State HY010: [Microsoft][SQL Server Native Client 11.0]Function sequence error

Earlier I was getting below error while executing this command.

So I added that filegroup to the database in SQL.

I also added all required data(.mdf) and index files(.ndf) and did the schema and data migration.

After doing this I executed this command again and started getting above error.

Please suggest me how can I resolve this :( ?

enable index Originator;

Error: #1900068: enable index failed

System Error: #1500811:
Error executing SQL: create table ix5687465873(

  id int not null,

  v1 nvarchar(255))

  on <[Filegroup name]>

System Error: #1: State 42000: [Microsoft][SQL Server Native Client 11.0][SQL Server]Invalid filegroup <‘Filegroup name’> specified.

Thanks.

Понравилась статья? Поделить с друзьями:
  • Octopus frp tool ошибка при запуске 0xc000007b
  • Oct 7 ошибка старлайн а93
  • Ocs inventory service код ошибки 20
  • Ocr с ошибками что это
  • Oce plotwave 345 ошибка 22552