Error hy000 odbc firebird driver firebird dynamic sql error

Hello.
  • Remove From My Forums
  • Question

  • Hello.

    I can’t retreive any data from an adbc connection to Firebird 2.5 server. I’ve tried with 32 and 64 bit odbc driver and the error it’s the same:

    Failed to retrieve data from TABLE. Reason: ERROR [HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL Error

    SQL error code = -104

    Token unknown — line 1, column 10

    If I try the same odbc connection on a regular import data in Excel, it’s perfect. This error it’s the same no matter what table I choose. If i thry to write the query myself it’s the same.

Answers

  • Hi Rsilva,

    We try to automatically formulate queries for different data sources however for unknown sources we fall back to SQL Server thus it fails on your occassion.

    As you mentioned you can still continue create manual custom queries, instead of table selection and continue importing data.


    Thanks, Deva [MSFT] My blog: http://powerpivot.spaces.live.com/

    • Marked as answer by

      Sunday, April 10, 2011 2:57 AM

   braynt

10.06.11 — 11:48

Собственно, интересует вопрос кто-нибудь подключался?

У меня подключиться получилось. Но запрос не выполняется:

ошибка при выполнении запроса

по причине:

Ошибка ODBC. SQLSTATE: HY000

Номер ошибки: -104

Описание: [ODBC Firebird Driver][Firebird]Dynamic SQL Error

SQL error code = -104

Token unknown — line 1, column 12

22″. Подскажите куда копать?

   braynt

1 — 10.06.11 — 12:39

ни у кого не возникало подобных ошибок?

   AllJoke

2 — 10.06.11 — 12:40

скуль.ру

   ДенисЧ

3 — 10.06.11 — 12:40

«Token unknown»

Перевести?

   МишельЛагранж

4 — 10.06.11 — 12:41

(0) судя по ошибке — как раз нормально подключиться и не получилось.

Ругается на драйвер ODBC — вроде как не подходящий.

Как хоть подключались-то??

   ДенисЧ

5 — 10.06.11 — 12:41

(4) где ты ругань на драйвер видишь?

   МишельЛагранж

6 — 10.06.11 — 12:43

(5) вижу, что ошибку вызывает драйвер подключения.

   braynt

7 — 10.06.11 — 12:48

подключается нормально. Выводит таблицы. Выбираю нужные мне.

Ругается в режиме «Предприятия». Причем через «Управление внешними источниками» подключение происходит. А при открытии таблицы вываливается ошибка(0).

(3) Перевести я и сам смог. Текст запроса я не вижу.

   МишельЛагранж

8 — 10.06.11 — 12:53

Токен не распознался…

А здесь все форумы завалены, как лихо 1С подключается напрямую ко всем SQL-ям и прочим Файрбердам и хавает оттуда любые данные в любых количествах невзирая на различные структуры таблиц хранения и типы самих данных…

Хотя провозившись с этим «лихо подключается» перешли на промежуточную выгрузку в xls и оттуда — спокойно в 1С.

Так что поспрошайте «лихачей» ))

   МишельЛагранж

9 — 10.06.11 — 12:54

+(8) *на одном из предприятий перешли на промежуточную выгрузку в xls

   ДенисЧ

10 — 10.06.11 — 12:54

(8) Ты не поверишь. Она «лихо 1С подключается напрямую ко всем SQL-ям и прочим Файрбердам и хавает оттуда любые данные в любых количествах невзирая на различные структуры таблиц хранения и типы самих данных»

Если, конечно, ошибок в пятом и семнадцатом оперонах нет…

   ДенисЧ

11 — 10.06.11 — 12:54

(7) Вот и мы не видим. А ты его покажи..

   МишельЛагранж

12 — 10.06.11 — 12:57

(10) да-да, слышу такое с начала выпуска 8.0, а беспонтовые «подключатели» упорно портят статистику лихих подключений, tycvjnzh на выпуск 8.2 уже ))

   МишельЛагранж

13 — 10.06.11 — 12:57

*несмотря

   braynt

14 — 10.06.11 — 13:16

(11) каким образом?

   ДенисЧ

15 — 10.06.11 — 13:20

(12) у меня с 77 и до сих пор всё нормально подключается. У остальных руки.

(14) А я вижу твою программу?

   ado

16 — 10.06.11 — 13:40

(8) Угу, мы уже давно поняли, что 1С настолько плоха, что даже выход из ветвления не позволяет сделать.

   ado

17 — 10.06.11 — 14:12

(0) Запрос то покажешь?

   braynt

18 — 10.06.11 — 14:28

платформа сама генерирует запрос

   ado

19 — 10.06.11 — 14:33

(18) Телепатически?

   braynt

20 — 10.06.11 — 14:36

использую внешние источники данных. Платформа  8.2.14.460.

в конфигураторе я указываю с каких таблиц,какие поля брать.

   МаленькийВопросик

21 — 10.06.11 — 14:39

(0) зачем вам эта бд, позвольте узнать?

   МишельЛагранж

22 — 10.06.11 — 14:40

(16) мало того, и вы будете шокированы, — платформа 1С не отличает объекта Номенклатуры от объекта ТабличнаяЧасть!

(уже вижу заголовки интернетов: «1С-ники шокированы! Они не знали всей правды!»

   braynt

23 — 10.06.11 — 14:43

(21) это важно? к примеру получать данные о продажах. Просто в новой платформе появился интересный механизм — хочу посмотреть как он работает. Пока понимаю, что не очень :)

   МаленькийВопросик

24 — 10.06.11 — 14:45

(23) не самая гибкая база, для боевого использования не пойдет, имхо. используйте EXPRESS на крайняк…

   braynt

25 — 10.06.11 — 15:08

(24) к сожалению не могу

по поводу ошибки: все таки дело в ODBC драйвере. Поставил

Database Browse. Там есть возможность подключаться напрямую к БД и через ODBC. Через ODBC ошибка «Invalid stringlist index 10». А напрямую всё нормально. буду копать дальше :(

   ado

26 — 10.06.11 — 15:11

(20) Ну, там же все равно формируется какой-то запрос на языке запросов 1С. Вот на него бы взглянуть. Есть вероятность, что там, скажем, используется функциональность, не поддерживаемая Фаербирдовским диалектом SQL.

   braynt

27 — 10.06.11 — 15:26

Настроил подключение к базе

http://s012.radikal.ru/i320/1106/35/0f2b3bd49095.jpg

1с Получила список таблиц. Выбрал нужную мне таблицу, взял самую простую «Штрихкоды»

http://s50.radikal.ru/i128/1106/4d/e3228509b1aa.jpg

запустил в режиме Предприятия. выскакивает ошибка:

http://s41.radikal.ru/i091/1106/1c/beee14095771.jpg

Где я могу увидеть запрос?

   МишельЛагранж

28 — 10.06.11 — 15:27

(26) если бы да кабы — то 1С была бы самой лучшей платформой на свете ))

У меня вопрос «там же все равно формируется какой-то запрос» возникает всегда, когда получаю данные в 1С. А ответа нет уже много-много лет.

(25) т.е. вопрос решился правильным подходом, а не танцами 1С-ников с бубном? ))

   МишельЛагранж

29 — 10.06.11 — 15:27

(27)… или не решился? ))

   braynt

30 — 10.06.11 — 15:33

неа не решился. Данные я так и не смог получить — буду думать дальше (

   ado

31 — 10.06.11 — 15:49

(27) Ну, значит недопилила 1С внешние источники пока. Пользуйся ADODB по старинке.

   braynt

32 — 10.06.11 — 15:54

(31)через ADODB и работает :). Просто хотелось скорость работы посмотреть )

   ado

33 — 10.06.11 — 16:00

(32) А почему скорость работы отличаться должна?

   braynt

34 — 10.06.11 — 16:52

Ну через внешние источники все делает платформа. И я могу в запросе связать с данными 1с базы. А через ADO я получаю ТЗ.

   raykom

35 — 10.06.11 — 17:20

(0) Ошибка -104 в iSQL базах встречалась на ранних релизах при использовании комментариев. На последних релизах вроде пишут на форумах, что исправлено.

Такую же ошибку выдает неверно поставленный разделитель, особенно если такая ошибка выходит в первых строках запроса.

Т.к. тут запрос генерируется платформой, то ты его не допилишь, наверное. Попробуй обновить FB

   braynt

36 — 10.06.11 — 17:41

Спасибо! Стоит релиз 2.1. Попробую обновить до 2.5

   МишельЛагранж

37 — 10.06.11 — 17:48

(35) >>Т.к. тут запрос генерируется платформой, то ты его не допилишь

— а тру-1Сники против.

(36) в FireBird много ошибок в этих релизах (бесплатный все-таки), всегда желательно ставить последнюю версию.

Странно, что вы на 2.1 не познакомились с переполнением файла базы. Хотя, может база маленькая…

   braynt

38 — 10.06.11 — 17:58

200 мегабайт

  

ShoGUN

39 — 10.06.11 — 18:04

Давно бы уже руками через ADO запрос написал…

  • Remove From My Forums
  • Question

  • I have a stored procedure (sproc)  running in Firebird Database. Now I try to use this sproc to build a report in the SSRS 2012 (SSDT) Report Designer.

    After I connect to the dataset, and when I choose the Query Type as ‘Stored Procedure’, and type the name of  my sproc, and then go to the Query Designer, and click ! (F5)  ,   I get the following error:

    TITLE: Microsoft SQL Server Report Designer
    ——————————

    An error occurred while executing the query.
    ERROR [HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL Error
    SQL error code = -104
    Token unknown — line 1, column 1 [sproc name] 

    ——————————
    ADDITIONAL INFORMATION:

    ERROR [HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL Error
    SQL error code = -104
    Token unknown — line 1, column 1 [sproc name] (OdbcFb)

    ——————————
    BUTTONS:

    OK
    ——————————

    Any idea on how to resolve this? If its a T-SQL sproc, then it will be no issue; in this case,  Firebird database connects to the SSRS via a 32-bit System ODBC connection.

    When I proceed and click ok for everything, I get this error (after I exit the Query Designer), in the Dataset Properties tab:

    «Could not update a list of fields for the query. Verify that you can connect to the data source and that your query syntax is correct.»

    The ODBC connection between SSRS and Firebird works fine. In fact I am able to run many queries as ad-hoc ones,  but when I use the queries as sprocs, then this issue pops up.

    Any suggestion on how to handle Firebird stored procedures  in SSRS will be greatly appreciated.

    • Edited by

      Saturday, August 22, 2015 8:19 AM

Answers

  • I figured this out:

    In my case, I am using a Firebird 2.5 database as source, and the SSRS connects to the Firebird 2.5 database via (i) a 32-bit System DSN ODBC connection in the SSDT side, and (ii) a 64-bit System DSN ODBC connection in the Report Manager side.

    For any database other than SQL Server, SSRS does not recognize the type of object — say views, stored procedures, or tables.. —— to SSRS any object belonging to an alien database such as Firebird is a
    table; for example SSRS does not distinguish a stored procedure from a table in such databases — and ‘sees’ the stored procedure as a table!

    So in the Dataset Properties tab in the Report Designer (SSDT), I chose the
    Query Type as
    Text
    (even though the object referred to is a stored procedure), and wrote this statement:

    SELECT * FROM [StoredProcedureName] (?,?)

    (the question marks denote the 2 parameters of this stored procedure, Firebird database jargon — PSQL language)

    This in turn retrieves all the columns from the object specified — in this case a stored procedure.

    So, the main point to note is  — do
    not
    choose the other two options in the Query Type in the Dataset Properties (in SSDT) — (1) Table (or) (2) Stored Procedure.
    Always choose the Text option, and write a statement as the one above.

    From now onwards, SSRS will function normally, as if the database referred to is s SQL Server one; one main point to understand
    is that the question marks become — Parameter1  and Parameter2  (in the Parameters folder in the Report Data tab) after you click OK to exit the Dataset Properties. The parameters are in the same order as per the declaration in the stored procedure
    creation.  So you can change only the Prompt (names) in the Report Parameter Properties window.Passing values to the parameters have to be made as per the the way it is done in the stored procedure, particularly in the same order.

    • Marked as answer by
      sph1777
      Saturday, August 29, 2015 7:24 PM
    • Edited by
      sph1777
      Saturday, August 29, 2015 7:27 PM

Содержание

  1. Как исправить ошибку Dynamic Sql: -104; Token Unkown — использование подзапроса в предложении where для фильтрации по максимальной дате
  2. Odbc firebird driver firebird dynamic sql error 104
  3. Вопрос
  4. Ответы
  5. Все ответы
  6. Odbc firebird driver firebird dynamic sql error 104
  7. Answered by:
  8. Question
  9. Answers
  10. All replies
  11. Odbc firebird driver firebird dynamic sql error 104

Как исправить ошибку Dynamic Sql: -104; Token Unkown — использование подзапроса в предложении where для фильтрации по максимальной дате

Я пытаюсь запросить базу данных firebird в первый раз, и я продолжаю получать

Кажется, это проблема с пунктом WHERE . CERT_DATE — это тип данных TIMESTAMP . Спасибо!

Я попытался использовать TIMESTAMP , думая, что это может быть ошибкой, но получил те же результаты. Любая помощь будет принята с благодарностью.

Запрос выглядит разумным. Иногда повторный ввод запроса может исправить ситуацию, потому что случайно включен какой-то скрытый символ.

Спасибо. попробую перепечатать. я не объединяю; ну не намеренно 😉 Я использую бесплатную пробную версию RazorSQL. Обычно я использую MSSQL Server.

Ваше сообщение об ошибке должно показать вам столбец и строку ошибки, а также конкретный токен, который там не разрешен. Так что читайте и ставьте ВЕСЬ текст той ошибки

Какую версию Firebird вы используете? И, пожалуйста, опубликуйте полное сообщение об ошибке, обычно в неизвестных ошибках токена также есть строка с «неизвестным» токеном, вызвавшим ошибку.

Ах. да, я забыл включить номера столбцов и строк в сообщение об ошибке. Они заключаются в следующем: ОШИБКА: динамическая ошибка SQL; Код ошибки SQL = -104; Токен неизвестен — строка 11, столбец 30; AS [SQLState: 42000, код ошибки ISC: 335544634] Код ошибки: 335544634 Спасибо!

Спасибо всем за вашу помощь! Сегодня я узнал, что использую старую версию Firebird, которая больше не поддерживается, и синтаксис, к которому я привык, отличается. Следующий шаг — обновиться до Firebird 2.0 или перейти на MSSQL.

@ M.Coull Я бы посоветовал, если вы собираетесь обновиться, перейти на 2.5 или 3.0. Firebird 2.0 также больше не поддерживается.

Ошибка указывает на то, что вы используете Firebird 1.5 или более раннюю версию. Проблема в том, что Firebird 1.5 и более ранние версии не поддерживают AS для определения псевдонимов таблиц.

В InterBase 6, Firebird 1 и Firebird 1.5 предложение FROM было определено как (из справочника по языку InterBase 6.0):

Как видите, этот синтаксис не позволяет использовать AS перед alias (иначе это был бы [[AS] alias] ). Эта поддержка дополнительного токена AS была добавлена ​​в Firebird 2.0 как часть поддержки Производные таблицы.

В качестве краткосрочного решения замените CERTS AS Z на CERTS Z .

Однако вам действительно следует обновиться: Firebird 1.5 больше не поддерживается (поддержка была прекращена почти 10 лет назад!) и содержит известные проблемы безопасности, которые были исправлены в более поздних выпусках Firebird.

Большое спасибо! Я только что унаследовал эту базу данных Firebird в понедельник, и у меня никогда не было опыта работы с Firebird в прошлом. Я бы никогда не догадался об этом сам. План состоит в том, чтобы перенести данные в базу данных MSSQL.

@ M.Coull В этом случае это компромисс. Начиная с версии 1.5 было добавлено множество более продвинутых функций SQL, которые могут помочь при миграции, с другой стороны, простое обновление базы данных 1.5 до версии 2.0 или выше может привести к некоторым проблемам совместимости, с которыми вы, возможно, не захотите иметь дело, если вы просто делаете разовая миграция.

@ M.Coull В любом случае, я знал, что AS должен работать, поэтому нужно было попробовать более старые версии, пока я не получил ту же ошибку;)

Ты человек! Еще раз спасибо!

1.5 на 2.0 изменили многие нестандартные причуды Interbase, хотя и в сторону более формальных и неформальных стандартов SQL, и могут нарушить работу приложения. У нас есть внутренняя самодельная CRM, которая скоро мирно умрет, она до сих пор использует BDE и FB 1.5 и ее не удалось перенести даже на 2.1. Так что, несмотря на то, что использование 1.5 действительно ужасно, мигрировать может быть не так просто.

Источник

Odbc firebird driver firebird dynamic sql error 104

Вопрос

I can’t retreive any data from an adbc connection to Firebird 2.5 server. I’ve tried with 32 and 64 bit odbc driver and the error it’s the same:

Failed to retrieve data from TABLE. Reason: ERROR [HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL Error

SQL error code = -104

Token unknown — line 1, column 10

If I try the same odbc connection on a regular import data in Excel, it’s perfect. This error it’s the same no matter what table I choose. If i thry to write the query myself it’s the same.

Ответы

We try to automatically formulate queries for different data sources however for unknown sources we fall back to SQL Server thus it fails on your occassion.

As you mentioned you can still continue create manual custom queries, instead of table selection and continue importing data.

Thanks, Deva [MSFT] My blog: http://powerpivot.spaces.live.com/

Все ответы

— In Excel goto to tab Data and select Connections

— Select PowerPivot Data in list and press Properties

— In Connection Properties select tab Definition and press button Authentication Settings.

— Tag radio button None in stead of Windows Authetication

Hope this works.

PowerPivot Data is not on Connection Properties.

I think I found the problem and it seems like a bug: All the queries are like this: SELECT * FROM FB.PHONE_LIST where FB is the DSN name. If I remove the FB. it works fine.

We try to automatically formulate queries for different data sources however for unknown sources we fall back to SQL Server thus it fails on your occassion.

As you mentioned you can still continue create manual custom queries, instead of table selection and continue importing data.

Thanks, Deva [MSFT] My blog: http://powerpivot.spaces.live.com/

have you already found out what caused the error?

I am having the same error on a few machines, no matter how long or big the SQL query is. Switching between 32 and 64 bit ODBC drivers and even 32 and 64 bit MS Office 2010 didn’t solve the problems. I used to have this error on older Win XP installations that had a grown structure through updates, patches and service packs. When reinstalling a new system, the problems were gone. Unfortunately, I now have them again on Win7 machines and haven’t figured out the cause yet.

Any help is appreciated!
Christian

For general connections to the db excel creates SQL Server conform statements for retrieving the data. This statement contains the name of the connection as table alias and therefore fails with Firebird odbc driver. Write your sql manually and it will work. Unfortunately until now there is no driver available that can handle this.

Источник

Odbc firebird driver firebird dynamic sql error 104

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Answered by:

Question

I can’t retreive any data from an adbc connection to Firebird 2.5 server. I’ve tried with 32 and 64 bit odbc driver and the error it’s the same:

Failed to retrieve data from TABLE. Reason: ERROR [HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL Error

SQL error code = -104

Token unknown — line 1, column 10

If I try the same odbc connection on a regular import data in Excel, it’s perfect. This error it’s the same no matter what table I choose. If i thry to write the query myself it’s the same.

Answers

We try to automatically formulate queries for different data sources however for unknown sources we fall back to SQL Server thus it fails on your occassion.

As you mentioned you can still continue create manual custom queries, instead of table selection and continue importing data.

Thanks, Deva [MSFT] My blog: http://powerpivot.spaces.live.com/

— In Excel goto to tab Data and select Connections

— Select PowerPivot Data in list and press Properties

— In Connection Properties select tab Definition and press button Authentication Settings.

— Tag radio button None in stead of Windows Authetication

Hope this works.

PowerPivot Data is not on Connection Properties.

I think I found the problem and it seems like a bug: All the queries are like this: SELECT * FROM FB.PHONE_LIST where FB is the DSN name. If I remove the FB. it works fine.

We try to automatically formulate queries for different data sources however for unknown sources we fall back to SQL Server thus it fails on your occassion.

As you mentioned you can still continue create manual custom queries, instead of table selection and continue importing data.

Thanks, Deva [MSFT] My blog: http://powerpivot.spaces.live.com/

have you already found out what caused the error?

I am having the same error on a few machines, no matter how long or big the SQL query is. Switching between 32 and 64 bit ODBC drivers and even 32 and 64 bit MS Office 2010 didn’t solve the problems. I used to have this error on older Win XP installations that had a grown structure through updates, patches and service packs. When reinstalling a new system, the problems were gone. Unfortunately, I now have them again on Win7 machines and haven’t figured out the cause yet.

Any help is appreciated!
Christian

For general connections to the db excel creates SQL Server conform statements for retrieving the data. This statement contains the name of the connection as table alias and therefore fails with Firebird odbc driver. Write your sql manually and it will work. Unfortunately until now there is no driver available that can handle this.

Источник

Odbc firebird driver firebird dynamic sql error 104

Работаю в больнице. Департамент здравоохранения купил нам программу «Управление иммунизацией» Питерской разработки, но сильно задержал её и вот теперь нам нужно в срок до 01.01.2008 года забить в неё 36 тыс. народу. Руками одному это сделать не по силам, а надо. Я знаю VFP, но не знаю FireBird на котором сделана база у этой проги, но тем не менее через ODBC подключился к ней, нашел таблицу в которой есть список пациентов, сконвертил его в DBF. А вот залить назад новый список не получается, — пробую так.

* коннектимся
n=sqlconnect(‘immun’,’SYSDBA’,») && Все пароли и пользователи прописаны в свойствах ODBC соединения
IF n>0
wait wind ‘Подключение успешное’ nowait
n2= SQLEXEC(n, ‘delete FROM casebook1’) && Очистить таблицу пациентов — это работает

* Открываем список пациентов который нужно залить в базу
sele 0
use kart && данные в таблице имеют ту-же структуру, что и таблица в базе casebook1 сервера FireBird
scatter memvar
* Вставить новую запись в таблицу пациентов
= SQLEXEC(n, ‘insert into casebook1 from memvar’)

* запишем ошибку в массив
=AERROR(aErrorArray)
FOR n = 1 TO 7 && Display all elements of the array
? aErrorArray(n)
ENDFOR
else
wait wind ‘ Подключиться не удалось ‘
RETURN
endif
Запускаем IBExpert и смотрим. Нифига не получилось, таблица стала пустой (сработала первая команда), но ничего не добавилось.

Смотрим ошибку:
1526
Connectivity error: [ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104
Token unknown — line 1, char 23
from

[ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104
Token unknown — line 1, char 23
from
HY000
-104
1
.NULL.

Мне это ни о чем не говорит, т.к. FireBird я вижу впервые, да и честно говоря через ODBC раньше не работал.
Какие могут быть причины того, что я не могу добавить строку. Правильный ли синтаксис команды INSERT? Может база имеет ряд каких-нибудь условий для добавления (триггеры)? Хотя в IBExpert я ничего не увидел, вроде простая таблица. Посоветуйте что-нибудь. И хорошую чайную доку по FireBird, ODBC и синтаксису SQL команд для работы через ODBC, т.к. фоксовский синтаксис не всегда работает.

Источник

I’ve got an application which uses pyodbc to connect to database. It can by run with different db engines. Now I try to adapt it to Firebird.

For some db engines (tested with sqlite, Sybase) I can use native pyodbc way to handle binding parametres:

cnxn = pyodbc.connect(connect_string, autocommit=True)
cur = cnxn.cursor()
cur.execute("insert into files (file_type_id, path, md5) values (?, ?, ?)", file_type_id, path, md5)

For Oracle I had to prepare some special SQL to be run:

cnxn = pyodbc.connect(connect_string, autocommit=True)
cur = cnxn.cursor()
sql = """DECLARE v_file_type_id INT; v_path varchar2(1024); v_md5 varchar2(32);
         BEGIN
         v_file_type_id := %d;
         v_path := '%s';
         v_md5 := '%s';
         insert into files (file_type_id, path, md5) values (v_file_type_id, v_path, v_md5);
         END;""" % (file_type_id, path, md5)
cur.execute(sql)

First way doesn’t work with Firebird. I receive error: pyodbc.IntegrityError: ('23000', '[23000] [ODBC Firebird Driver][Firebird]validation error for column FILE_TYPE_ID, value "*** null ***" (-625) (SQLExecDirectW)').

I tried to prepare dedicated SQL, just like for Oracle, but I’ve got some problems with it.

cnxn = pyodbc.connect(connect_string, autocommit=True)
cur = cnxn.cursor()
sql = """set term ^ ;
         execute block
         as
         declare v_file_type_id int = %d;
         declare v_path varchar(1024) = '%s';
         declare v_md5 varchar(32) = '%s';
         begin
         insert into files (file_type_id, path, md5) values (:v_file_type_id, :v_path, :v_md5);
         end
         ^
         set term ; ^""" % (file_type_id, path, md5)
cur.execute(sql)

It doesn’t work. The rror this time is: pyodbc.Error: ('HY000', '[HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL ErrornSQL error code = -104nToken unknown - line 1, column 5nterm (-104) (SQLExecDirectW)').

I’m looking for any sollution, so I’ll be able to run it in any of that 2 ways. Performance aspect is also very important — application isn’t run very often, but each time that part of code makes about 50k inserts to files table.

Hey guys, as the title says I’m trying to write to an SQL database using VB.net and I’m a little stuck.

Here is the code I’m using;

Dim conn As OdbcConnection
        Dim comm As OdbcCommand
        Dim connectionString As String
        Dim sql As String
        connectionString = «Driver=Firebird/InterBase(r) driver;User=SYSDBA;Password=masterkey;Database=c:databaseTime sheet.fdb;DataSource=SBSSERVER; Port=3051;Dialect=3; Charset=NONE;Role=;Connection lifetime=15;Pooling=true; MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0;»
        conn = New OdbcConnection(connectionString)
        conn.Open()
        Sql = «insert into Clockins (X_ID, X_User_ID, X_Safescan_ID, X_Clock_ID, X_Clock_In_Time) values (‘» & x & «, » & User & «, » & SS_ID & «, » & Clock_Id & «, » & Clock_Time & «‘)»
        Try
            comm = New OdbcCommand(Sql, conn)
            comm.Connection = conn
            comm.ExecuteNonQuery()
        Finally
            conn.Close()
        End Try

When I run this i get the following error;

«An unhandled exception of type ‘System.Data.Odbc.OdbcException’ occurred in System.Data.dll

Additional information: ERROR [HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL Error

SQL error code = -804

Count of read-write columns does not equal count of values»

The columns are the same in the code and the table so I don’t really know why this is happening.

Misha454

1

Не могу запустить хранимую процедуру

03.11.2009, 14:08. Показов 2698. Ответов 2


Здраствуйте. Проблема такая: Установил Firebird 2.0, IBExpert 2009, создал базу, в ней таблицу и несколько процедур. Создаю приложение в Visual Studio 2008 подключаюсь к базе могу делать запросы получаю таблицы, но не могу запустить хранимые процедуры … Можете подсказать почему

Добавлено через 15 минут
ошибся Firebird 2.1.2

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

Misha454

03.11.2009, 19:43

2

текст проги:

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
private void button4_Click(object sender, EventArgs e)
        {
            OdbcCommand sp = new OdbcCommand("'PAROL_INS'", con);
            sp.CommandType = CommandType.StoredProcedure;
            OdbcParameter vhod = new OdbcParameter();
            vhod.ParameterName = "IMYA";
            vhod.OdbcType = OdbcType.VarChar;
            vhod.Value = textBox1.Text;
            sp.Parameters.Add(vhod);
 
             vhod = new OdbcParameter();
            vhod.ParameterName = "PASWORD";
            vhod.OdbcType = OdbcType.Char;
            vhod.Value = textBox2.Text;
            sp.Parameters.Add(vhod);
 
             vhod = new OdbcParameter();
            vhod.ParameterName = "DOSTUP";
            vhod.OdbcType = OdbcType.Int;
            vhod.Value = 4;
            sp.Parameters.Add(vhod);
 
            sp.ExecuteNonQuery();
            OdbcCommand tab = new OdbcCommand("PAROL", con);
            tab.CommandType = CommandType.TableDirect;
            dataGridView1.DataSource= tab.ExecuteNonQuery();
        }

Добавлено через 48 секунд
текст ошибки:

Добавлено через 28 секунд
ERROR [HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104
Token unknown — line 1, char 0
‘PAROL_INS’

Добавлено через 2 минуты
процедура точно есть в ibexpert работает

xxc

3 / 3 / 0

Регистрация: 27.10.2009

Сообщений: 11

07.11.2009, 20:49

3

Не силен в С и в ODBC, но посоветовал бы сделать следующее:
Если не нужно получать из процедуры какие-либо данные, сделать

C#
1
OdbcCommand sp = new OdbcCommand("execute procedure PAROL_INS(:IMYA, :PASWORD, :DOSTUP)", con);

Если процедура должна возвращать какие-либо данные — то так:

C#
1
OdbcCommand sp = new OdbcCommand("select SOMEFIELD1, SOMEFIELD2 from PAROL_INS(:IMYA, :PASWORD, :DOSTUP)", con);

А с параметрами работать уже через объект sp — должны там быть методы соответствующие. По идее, параметры должны создаваться автоматически при парсинге SQL-запроса.



0



Hi Pablo,

I did that and got the same error.

Here is the Query without that

SELECT
  "Lehrer"."Nachname", "Lehrer"."Vorname", "Lehrer"."Telefon", "Lehrer"."Mandant",
  "Lehrer"."Status", "AuswahlLehrer"."Mandant", "Lehrer"."Geburtsdatum",
  "Lehrer"."Staatsangeh", "Lehrer"."Strasse", "Lehrer"."Ort", "Lehrer"."Email",
  "Lehrer"."ZugangDatum", "Lehrer"."Dienstalter", "Lehrer"."LetzteUeberpruefung",
  "Dienstbez"."Bezeichnung", "Besoldungen"."Bezeichnung", "Lehrer"."Geschlecht",
  "Lehrer"."Telefax", "Konfessionen"."Bezeichnung"

FROM (((" "."AuswahlLehrer" "AuswahlLehrer" LEFT OUTER JOIN " "."Lehrer" "Lehrer" ON ("AuswahlLehrer"."Mandant"="Lehrer"."Mandant") AND ("AuswahlLehrer"."Lehrer"="Lehrer"."ID")) LEFT OUTER JOIN " "."Besoldungen" "Besoldungen" ON "Lehrer"."Besoldung"="Besoldungen"."Kuerzel") LEFT OUTER JOIN " "."Dienstbez" "Dienstbez" ON "Lehrer"."Dienstbez"="Dienstbez"."Kuerzel") LEFT OUTER JOIN " "."Konfessionen" "Konfessionen" ON "Lehrer"."Konfession"="Konfessionen"."Kuerzel"

WHERE  "Lehrer"."Status"=1
ORDER BY
  "Lehrer"."Mandant", "Lehrer"."Nachname", "Lehrer"."Vorname"


And the error is on this line:

FROM (((" "."AuswahlLehrer" "AuswahlLehrer" LEFT OUTER JOIN " "."Lehrer" "Lehrer" ON

It doesn’t want the dot, or this kind of syntad: “ “. “AuswahlLehrer“

Again, the query is not done by us, but comes from the report in crystal reports.
I know SQL but what Crystal produces is strange to me. I always thought it is the odbc kind of syntax
That is used and that the odbc driver translates it.

Using Easysoft driver works.

Regards
Antonio


Von: Pablo Sánchez [mailto:pa...@ad...]
Gesendet: Mittwoch, 12. Oktober 2016 17:49
An: fireb...@li...
Betreff: Re: [Firebird-odbc-devel] SQL-Error using ODBC-Driver 2.0.4 and Crystal Reports 2016

Antonio, does this query runs on isql or any db manager ?

Take the odbc stuff out of it (like opening "{oj " and closing "}" ) and try a run .

I see that the query, is shorter than 1165 chars....

Regards

Pablo

On 10/12/2016 11:04 AM, Antonio Cambule (STÜBER SYSTEMS) wrote:
Hello,

When it comes to execute a crystal reports file in the –most cases- (not all)
this error is thrown:

Fehler beim Öffnen eines Rowsets. (english: Error opening rowset)
Details: HY000:[ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104
Token unkown – line 1, column 1165
.

Here ist he part oft he odbc.log file:

Connection=Mage 1b84-12cc    ENTER SQLExecDirectW
                               HSTMT               0x082D1E30
                               WCHAR *             0x082D21BC [      -3] " SELECT "Lehrer"."Nachname", "Lehrer"."Vorname", "Lehrer"."Telefon", "Lehrer"."Mandant", "Lehrer"."Status", "AuswahlLehrer"."Mandant", "Lehrer"."Geburtsdatum", "Lehrer"."Staatsangeh", "Lehrer"."Strasse", "Lehrer"."Ort", "Lehrer"."Email", "Lehrer"."ZugangDatum", "Lehrer"."Dienstalter", "Lehrer"."LetzteUeberpruefung", "Dienstbez"."Bezeichnung", "Besoldungen"."Bezeichnung", "Lehrer"."Geschlecht", "Lehrer"."Telefax", "Konfessionen"."Bezeichnung" FROM   {oj (((" "."AuswahlLehrer" "AuswahlLehrer" LEFT OUTER JOIN " "."Lehrer" "Lehrer" ON ("AuswahlLehrer"."Mandant"="Lehrer"."Mandant") AND ("AuswahlLehrer"."Lehrer"="Lehrer"."ID")) LEFT OUTER JOIN " "."Besoldungen" "Besoldungen" ON "Lehrer"."Besoldung"="Besoldungen"."Kuerzel") LEFT OUTER JOIN " "."Dienstbez" "Dienstbez" ON "Lehrer"."Dienstbez"="Dienstbez"."Kuerzel") LEFT OUTER JOIN " "."Konfessionen" "Konfessionen" ON "Lehrer"."Konfession"="Konfessionen"."Kuerzel"} WHERE  "Lehrer"."Status"=1 ORDER BY "Lehrer"."Mandant", "Lehrer"."Nachname", "Lehrer"."Vorname" 0"
                               SDWORD                    -3

Connection=Mage 1b84-12cc    EXIT  SQLExecDirectW  with return code -1 (SQL_ERROR)
                               HSTMT               0x082D1E30
                               WCHAR *             0x082D21BC [      -3] " SELECT "Lehrer"."Nachname", "Lehrer"."Vorname", "Lehrer"."Telefon", "Lehrer"."Mandant", "Lehrer"."Status", "AuswahlLehrer"."Mandant", "Lehrer"."Geburtsdatum", "Lehrer"."Staatsangeh", "Lehrer"."Strasse", "Lehrer"."Ort", "Lehrer"."Email", "Lehrer"."ZugangDatum", "Lehrer"."Dienstalter", "Lehrer"."LetzteUeberpruefung", "Dienstbez"."Bezeichnung", "Besoldungen"."Bezeichnung", "Lehrer"."Geschlecht", "Lehrer"."Telefax", "Konfessionen"."Bezeichnung" FROM   {oj (((" "."AuswahlLehrer" "AuswahlLehrer" LEFT OUTER JOIN " "."Lehrer" "Lehrer" ON ("AuswahlLehrer"."Mandant"="Lehrer"."Mandant") AND ("AuswahlLehrer"."Lehrer"="Lehrer"."ID")) LEFT OUTER JOIN " "."Besoldungen" "Besoldungen" ON "Lehrer"."Besoldung"="Besoldungen"."Kuerzel") LEFT OUTER JOIN " "."Dienstbez" "Dienstbez" ON "Lehrer"."Dienstbez"="Dienstbez"."Kuerzel") LEFT OUTER JOIN " "."Konfessionen" "Konfessionen" ON "Lehrer"."Konfession"="Konfessionen"."Kuerzel"} WHERE  "Lehrer"."Status"=1 ORDER BY "Lehrer"."Mandant", "Lehrer"."Nachname", "Lehrer"."Vorname" 0"
                               SDWORD                    -3

                               DIAG [HY000] [ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, column 460
. (-104)


Is this behaviour known?
Any idea if this can be solved?


regards
Antonio Cambule




------------------------------------------------------------------------------

Check out the vibrant tech community on one of the world's most

engaging tech sites, SlashDot.org! http://sdm.link/slashdot




_______________________________________________

Firebird-odbc-devel mailing list

Fireb...@li...<mailto:Fireb...@li...>

https://lists.sourceforge.net/lists/listinfo/firebird-odbc-devel

Понравилась статья? Поделить с друзьями:
  • Error hy000 microsoft odbc microsoft access
  • Error hy000 executing statement
  • Error hwnd was not declared in this scope
  • Error hunter перевод
  • Error hung gpu detected