Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Problems if ODBC connection

Posted on 2003-11-19
Medium Priority
Last Modified: 2007-12-19

I have problem with connecting to Navision Native DB thought ODBC.
I wrote simple program that connects to Navision DB thought ODBC, it works fine. Then - extended stored procedure for SQL server, but it throws exception then connecting DB

dbconnect->OpenEx("Database=C:\\Navision Attain\\Client\\database.fdb;RD=No;DSN=NavisionDB;CSF=No;CN=CRONUS Lithuania u.a.b.;CC=Yes;OPT=Text;CD=No;ML=1063;SERVER=N;BE=Yes;IT=All Except DOT;PPath=C:\\Navision Attain\\Client;QTYesNo=Yes;RO=No",CDatabase::noOdbcDialog);

Exception: ex->m_strError == -1
ex->m_strError == „ISAM error“

What does it mean?
And more, if connect string is
“MaxBufferSize=2048;FIL=MS Access;DSN=UsersDB;PageTimeout=5;UID=admin;DBQ=D:\\WORK\\JAVA\\DATABASE\\Users.mdb;DriverId=25”
– Access DB then every thing works fine, xp too.

I don’t get it, what’s wrong?
Question by:AshooT
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
LVL 18

Accepted Solution

Cluskitt earned 400 total points
ID: 9786406
> Database=C:\\Navision Attain\\Client\\database.fdb
fdb? was that a typo posting here, or is it a typo in your program? There are several programs that crete databases with the FDB extension, on the correct connect string you have .mdb, so I assume it's a typo.
If it's a typo here, then please try to paste the correct exact connection string. If it's a typo in the program, then that could be the cause.

Author Comment

ID: 9786614
.fdb it is Navision Attain Native Database. And connection string here is correct, because I can connect with it in my program, but then the same code in extended stored procedures – crashes. :((
Thanks any way!!!
LVL 18

Expert Comment

ID: 9786646
Can you post the procedures here? The problem could be in the procedure itself, not in the connection string.
In fact, if you say you can do it with your program, then it must be in the procedures.
Anyway, can you post the code so we can try to find something wrong with it, please?
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 9786805
Ok, np =)

#include <string.h>
#include <afxdb.h>
#include <atlstr.h>
#include <Srv.h>
#include <stdio.h>
#include "XP_GetNavisionTable.h"

SRVRETCODE  xp_getnavisiontable(SRV_PROC* srvproc);
ULONG __GetXpVersion();
void printMessage(SRV_PROC *pSrvProc, CHAR* message);

ULONG __GetXpVersion()
    return ODS_VERSION;

SRVRETCODE  xp_getnavisiontable(SRV_PROC* srvproc)
                DBCHAR colname[500];
      //_snprintf(colname, MAXCOLNAME, "Text");
      //srv_describe(srvproc, 1, colname, SRV_NULLTERM, SRVCHAR, MAXNAME,
                //                    SRVCHAR, 0, NULL);

      printMessage(srvproc, "1");
      CString varValue;

      CDatabase *dbconnect = new CDatabase();
      printMessage(srvproc, "2");

            dbconnect->OpenEx("Database=C:\\Navision Attain\\Client\\database.fdb;RD=No;DSN=NavisionDB;CSF=No;CN=CRONUS Lithuania u.a.b.;CC=Yes;OPT=Text;CD=No;ML=1063;SERVER=N;BE=Yes;IT=All Except DOT;PPath=C:\\Navision Attain\\Client;QTYesNo=Yes;RO=No",CDatabase::noOdbcDialog);
            printMessage(srvproc, "3");
      } catch (CDBException *ex) {
            printMessage(srvproc, "Error: connection Navision DB");
            _snprintf(colname, 500, "%s %s\nError code: %i",
            printMessage(srvproc, colname);
            return XP_ERROR;

      CRecordset *record = new CRecordset(dbconnect);
      record->Open(CRecordset::forwardOnly, "SELECT * FROM Pirk&#279;jas");
      printMessage(srvproc, "4");

      short nFields = record->GetODBCFieldCount();
      printMessage(srvproc, "5");
      while( !record->IsEOF( ) )
            for( short index = 0; index < nFields; index++ )
                  record->GetFieldValue( index, varValue );
                  /// printig
            record->MoveNext( );
      printMessage(srvproc, "6");

      delete record;
      delete dbconnect;
      printMessage(srvproc, "7");


      srv_senddone(srvproc, SRV_DONE_MORE | SRV_DONE_COUNT, (DBUSMALLINT)0, 0);

      return  XP_NOERROR;

void printMessage(SRV_PROC *pSrvProc, CHAR* message)
    srv_sendmsg(pSrvProc, SRV_MSG_INFO , 0, SRV_INFO, 1,
                  NULL, 0, (DBUSMALLINT) __LINE__,

This is my tiny stored procedure,
If you fide an error or soliution it would be greate!!! Because I looking for soliution all this week :((
LVL 18

Expert Comment

ID: 9786937
Can you also insert the code for XP_GetNavisionTable.h? Since the procedure seems to be loading from definitions there, the error could be there, or, at least, it could help understand where the error might be coming from.

Author Comment

ID: 9795177
Sure  Cluskitt:
//                              File : XP_GetNavisionTable.h
#define XP_NOERROR      0
#define XP_ERROR        1

#define MAXCOLNAME                        25
#define MAXNAME                              25
#define MAXTEXT                              255

#ifdef _MSC_VER
#define DBL_CDECL                    __cdecl
#define DBL_CDECL                    _cdecl

#define MAX_SERVER_ERROR         20000

//                              File : XP_GetProcedureDefinition.def
LIBRARY      XP_GetNavisionTable


All files naw here :))
LVL 18

Expert Comment

ID: 9796279
Ok, I will check on that and reply to you this weekend. With some luck, tonight. I'm at work now and having a busy day, so I can't really focus on that now, but I already printed it and will check it on my way home on the train! ;-)

Author Comment

ID: 9809279
Oki, Thanks Cluskitt!!!
I have a really greate headache with thid dll ;)))
LVL 18

Assisted Solution

Cluskitt earned 400 total points
ID: 9817255
Ok, I couldn't find an error, as your code is above my knowledge, but I passed your question to an "expert" I know! As soon as I have an answer, I'll let you know! ;-)
BTW, you're using VC++, right?

Author Comment

ID: 9817607
Yep, I using VC++ .NET
I asked some "experts" too, but still didn't get any answers or they couldn't help me.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question