Hello:

#include <stdio.h>  // for printf
#include <D:\Programavimas\Naujas Darbas\SQLAPI\include\SQLAPI.h> // main SQLAPI++ header

int main(int argc, char* argv[])
{
    SAConnection con; // create connection object
    
    try
    {
        // connect to database
        // in this example it is Oracle,
        // but can also be Sybase, Informix, DB2
        // SQLServer, InterBase, SQLBase and ODBC
        con.Connect(
            "test",     // database name
            "tester",   // user name
            "tester",   // password
            SA_Oracle_Client);

        printf("We are connected!\n");

        // Disconnect is optional
        // autodisconnect will ocur in destructor if needed
        con.Disconnect();

        printf("We are disconnected!\n");
    }
    catch(SAException &x)
    {
        // SAConnection::Rollback()
        // can also throw an exception
        // (if a network error for example),
        // we will be ready
        try
        {
            // on error rollback changes
            con.Rollback();
        }
        catch(SAException &)
        {
        }
        // print error message
        printf("%s\n", (const char*)x.ErrText());
    }
    
    return 0;
}

This is the library code, and i got those errors:
[Linker Error] Unresolved external 'SAException::~SAException()' referenced from D:\PROGRAMAVIMAS\NAUJAS DARBAS\SQLAPI\SAMPLES\STEP1.OBJ
[Linker Error] Unresolved external 'SAString::~SAString()' referenced from D:\PROGRAMAVIMAS\NAUJAS DARBAS\SQLAPI\SAMPLES\STEP1.OBJ
and more..
This is MYSQLAPI library, i tried ussing mysqlwrapper, and got another error, as there is MYSQL mysql variable, and it say, that it is not defined... I'm using Borland builder 6.

Well, i added that folder to my project folder and then included the header of the library which i need, anyway then i'm trying to use
Edit : Including the header only.

SAConnection  con2;

con2.Connect("srvname@dbname", "username", "password", SA_Sybase_Client);

Got same problems, As i uderstood from you reply, i should also include DLL ?

Any advices? Or there is a good tutorials about including libraries, as i googled, the main articles are the libraries, but not how to use them..

No tutorial because each compiler does it differently. I don't know how Borland Builder 6 does it -- you should ask someone in the Borland support forums.

In
http://www.sqlapi.com/OnLineDoc/index.html
it says that for Borland, the following libraries are available to choose from

sqlapib.lib - for linking with release version of dynamic library (Borland C++)
sqlapibd.lib - for linking with debug version of dynamic library (Borland C++)
sqlapibs.lib - for linking with release version of static library (Borland C++)
sqlapibsd.lib - for linking with debug version of static library (Borland C++)

So for example, if you link with the debug version of the dynamic library, then you need to add the sqlapibd.lib library in Project/Options/Linker/Linking - Additional options.

I take that you have these files on your computer (?)

Yes, i got those files. I'm using Borland C++ builder 6, as i can't install newone codegear - after instalation dll errors.. Anyway, back to the topic i tried to add my lib by the way of Importing Type library, but then it says, it doesn;t find that library..

i tried to add my lib by the way of Importing Type library

The .lib files are not type libraries, so forget that.

Basically you now just need to add the required library file to your project's linker input configuration, so that the linker finds the expected library code to pull in to your program.

As a test, try adding the library

sqlapibd.lib

in the IDE's Project/Options/Linker/Linking - Additional options -field. If you don't have that specific configuration item, try to find something similar in the project's options.

Then build the project and post the compiler/linker output

The .lib files are not type libraries, so forget that.


in the IDE's Project/Options/Linker/Linking - Additional options -field.

Then build the project and post the compiler/linker output

You see, there isint such field, i just manage to go to IDE's Project/Options/Linker/Linking and there is radiobox only..

You see, there isint such field, i just manage to go to IDE's Project/Options/Linker/Linking and there is radiobox only..

That's too bad then, because that property page is the place where this option for linking with additional libraries should be. I think I cannot help much more than suggest you to search for relevant topics (e.g. "Linker Linking" etc) in the IDE's help.

Eh, i searched through the help, but that checkbox, which probably will allow me to add that library does not shine, and i can't use it. On help this thing only written Generate import library only applies to DLL and Package targets. This option controls whether or not the linker creates an import library (for DLLs - .lib) or package import (for Packages - .bpi) along with your target. The import file is needed to use the DLL/package from an application. For example, if an application wanted to use your DLL, it would add the import library for your DLL to its project. Or if a user had your package installed and wanted to use a component from it, there would have to be a .bpi available.

Oh well, a simple thing turning out to be overly difficult.
One option for you might then be to build the project from command line. Most probably the Help system provides a detailed description on how to do that.

This article has been dead for over six months. Start a new discussion instead.