Sql Anywhere 11 Odbc Driver

Apr 19, 2016  The SAP SQL Anywhere Database Client includes the following components:Full set of available client interfaces, such as ODBC, JDBC, ADO.NET and so on.Administration tools such as SQL Central and Interactive SQL.Note: During installation you will be prompt. Jun 05, 2018  sql anywhere 11 odbc driver for windows In Visual Studio when I try to run the project it says all of the below, but the critical portion is “The specified DSN contains an architecture mismatch between the Driver and Application”. Microsoft ODBC Driver 11 for SQL Server is a single dynamic-link library (DLL) containing run-time support for applications using native-code APIs to connect to Microsoft SQL Server 2005, 2008, 2008 R2, SQL Server 2012, SQL Server 2014 and Windows Azure SQL Database. Microsoft ODBC Driver 11 for SQL Server should be used to create new applications or enhance existing applications that need to take advantage of new SQL Server 2012 features.

Active9 years, 6 months ago

I'm trying to connect from my ms windows 7 via the odbc administrator to a remotesybase sqlanywhere 11 database server.

But I get not connection, I'm not sure which configure option I have to specify.

server-name = ip address of remote database server?

startline ?

portnummer ?

Thank you, best regards, Alex

Alex
AlexAlex
2,0907 gold badges30 silver badges50 bronze badges

1 Answer

By default the SQL Anywhere server process dbsrv#.exe listens for incoming connections on port 2638.

Make sure your firewall allows outbound connections to that port.

Assuming you have a database running on your server as follows:

The server will broadcast on the tcp/ip layer on the default port (2638) under the name 'my_server_name' and the database will be accessible under the name 'my_database_name' via ODBC

Creating an ODBC entry for your new database to connect from a client (adjust for Windows 7)

There are other parameters available for LINKS (HOST, etc). Take a look at http://dcx.sybase.com/index.html#1101en/dbadmin_en11/da-using-tcpip.html

I've seen some rare issues with UDP broadcast packets. See the docs at http://dcx.sybase.com/1101en/dbadmin_en11/broadcastlistener-connection-conparm.html and check with your network administrator.

You can also use the dbping.exe utility to troubleshoot networking issues.

BTW, you may want to cross-post your question at http://sqla.stackexchange.com. It's full of SQL Anywhere buffs

Vincent BuckVincent Buck
13.6k2 gold badges16 silver badges21 bronze badges

Not the answer you're looking for? Browse other questions tagged odbcsqlanywhereadministrator or ask your own question.

Skip to end of metadataGo to start of metadata

Purpose

The purpose of this page is to discuss the configuration of ODBC client connections in the context of SQL Anywhere and Linux or Unix.

Overview

To work with your data, a connection must be established between a client application and a database server (serving a database or database file(s)).

ODBC (which stands for Open Data Base Connectivity) is an industry-standard interface to relational database management systems (RDBMSs). An ODBC data source encapsulates the information required to connect to a database. SQL Anywhere supports the ODBC interface on all platforms. ODBC data sources can be used to connect to SQL Anywhere from ODBC client applications, such as Sybase Central and Interactive SQL.

If the client computer is running Linux or another UNIX operating system, ODBC data sources can be used to connect with ODBC applications, as well as for Sybase Central and Interactive SQL.

Note: The SQL Anywhere command-line tools can use ODBC data sources (DSNs) for information about connections, although they may not necessarily use ODBC as the actual connection mechanism to the database server - many will use the DBTools or the DBLIB / Embedded SQL libraries internally.

Understanding Linking for ODBC Applications on Linux and Unix Operating Systems

ODBC is an application programming interface (API) that is invoked by the client program to connect to a database server. For a list of available ODBC API commands that a program can use, see Microsoft's ODBC API reference. In order to reference the ODBC API library, an ODBC program will refer to 'unixodbc.h' in its #include section and is then linked against a named library when it is compiled. unixodbc.h is included in the SQL Anywhere SDK directory.

The choice of how to link against the ODBC libraries at runtime is then up to the ODBC application developer:

  1. Link against the generic ODBC driver manager library available on the system (e.g. libodbc.so)
  2. Link against a specific ODBC driver manager library (e.g. libodm16.so)
  3. Link against a specific ODBC driver and provide all connection information inside the ODBC program (e.g. libdbodbc16.so)
Sql

1. Linking against the generic ODBC driver manager available on the Operating System

An example of a gcc application compile that would reference a generic ODBC library uses the switch '-lodbc':

gcc -lodbc odbc.c

This tells the application at load time to attempt to load the libodbc.so library file from the system path specified by the LD_LIBRARY_PATH environment variable. Typically this file will point to a third-party ODBC Driver Manager library. Linux and Unix systems do not come with a default ODBC driver manager - a separate driver manager must be downloaded and configured. Popular third-party ODBC Driver Managers that are available for many Linux and Unix distributions are unixODBC ( http://www.unixodbc.org/ ) and iODBC ( http://www.iodbc.org/ ).

2. Linking against a specific ODBC driver manager (SQL Anywhere ODBC Driver Manager for Unix)

Note: The SQL Anywhere ODBC Driver Manager for Unix is only intended for use and distribution with applications for access with SAP servers. The SAP HANA, SAP SQL Anywhere, SAP IQ, SAP Adaptive Server Enterprise (ASE), and SAP Advantage Database Server (ADS) ODBC drivers are the only supported and approved drivers that can be accessed through the SQL Anywhere ODBC Driver Manager for Unix.

Included with SQL Anywhere is the SQL Anywhere ODBC driver manager for Unix - this library is included as libdbodm16.so in the /lib32 or /lib64 directories. To use this alternate ODBC driver manager, a developer can either create a symbolic link from 'libodbc.so' to 'libdbodm16.so' and continue to link against the generic ODBC library as shown in the generic linking instructions above or a developer can link directly against the SQL Anywhere ODBC driver manager instead:

gcc -ldbodm16 sqlaodm.c

Warning: If the SQL Anywhere ODBC driver manager is used, only ODBC 3.0 API compatible calls can be used. The SQL Anywhere ODBC driver manager does not automatically perform ODBC 2.0 to 3.0 conversions - any ODBC 2.0 calls must be converted to their ODBC 3.0 equivalents.

If an ODBC driver manager is loaded, it will then proceed to load 'libodbcinst.so' to find the 'odbc.ini' information for the ODBC data source (see below). The client application can then use either the SQLConnect or SQLDriverConnect ODBC calls to connect to the database. If using SQLDriverConnect, the connection string information should contain 'DRIVER=SQL Anywhere 16' to load 'libdbodbc16.so' directly.

3. Linking against a specific ODBC driver (SQL Anywhere ODBC Driver)

Applications can also directly link against the SQL Anywhere ODBC driver library and have the ODBC driver act as its own driver manager. Developers can use a SQLDriverConnect call to SQL Anywhere with all of the required connection string information specified (outside of a DSN / odbc.ini information). The connection string information should contain 'DRIVER=SQL Anywhere 16' to load 'libdbodbc16.so' directly.

gcc -ldbodbc16 sqlaoodbc.c

Using Threaded Versus Non-threaded Client Libraries

Both threaded and non-threaded client libraries are provided with SQL Anywhere - it is important that your application selects the correct library at runtime. The threaded libraries all have names ending in _r. If your application is directly using ODBC, it is strongly recommended that you use the libdbodbc16 library shipped with SQL Anywhere 16, which automatically loads the appropriate non-threaded (libdbodbc16_n) or threaded (libdbodbc16_r) ODBC library, based on the application's thread needs. There is very little overhead added by using the libdbodbc16 library. Developers also have the option of referencing either the threaded or non-threaded libraries directly, but if this option is used the developer must ensure that they use and deploy the correct library for their application.

Understanding ODBC Data Sources

Data sources (DSNs) exist on the client computer. You should create one for each database accessible via ODBC. Data source definitions reside in the .odbc.ini file or in a separate .dsn file.

.odbc.ini

ODBC clients look for .odbc.ini in the following locations:

Sql Anywhere 11 Odbc Driver
  1. The $ODBCINI, $ODBC_INI, $ODBCHOME, and $HOME environment variables
  2. The current directory
  3. The user's home directory
  4. The executable path
  5. The $PATH, $LD_LIBRARY_PATH (library path), and $SQLANY16 (installation directory) directories
  6. The root directory

Note that it is possible to connect to databases without a data source by specifying all of the connection parameters in the connection string.

Installing the SQL Anywhere ODBC Driver

To connect to SQL Anywhere from ODBC applications on Linux, deploy the SQL Anywhere ODBC driver. Copy the required files to a deployment directory:

Linux, Solaris, HP-UX

libdbodbc16.so.1

libdbodbc16_n.so.1

libdbodm16.so.1

libdbtasks16.so.1

libdbicu16.so.1

libdbicudt16.so.1

dblg[LL]16.res

Linux, Solaris, HP-UX MT

libdbodbc16.so.1

libdbodbc16_r.so.1

libdbodm16.so.1

libdbtasks16_r.so.1

libdbicu16_r.so.1

libdbicudt16.so.1

dblg[LL]16.res

AIX

libdbodbc16.so

libdbodbc16_n.so

libdbodm16.so

libdbtasks16.so

libdbicu16.so

libdbicudt16.so

dblg[LL]16.res

AIX MT

libdbodbc16.so

libdbodbc16_r.so

libdbodm16.so

libdbtasks16_r.so

libdbicu16_r.so

libdbicudt16.so

dblg[LL]16.res

Mac OS X

dbodbc16.bundle

libdbodbc16.dylib

libdbodbc16_n.dylib

libdbodm16.dylib

libdbtasks16.dylib

libdbicu16.dylib

libdbicudt16.dylib

dblg[LL]16.res

Mac OS X MT

dbodbc16_r.bundle

libdbodbc16.dylib

libdbodbc16_r.dylib

libdbodm16.dylib

libdbtasks16_r.dylib

libdbicu16_r.dylib

libdbicudt16.dylib

dblg[LL]16.res

Warning: When deploying files for AIX, ensure that the correct bitness of the library appears first on the system LD_LIBRARY_PATH. Bitnesses are not checked when loading files from this path.

With the SQL Anywhere ODBC driver installed, you can create an ODBC data source (DSN) that uses this driver. You can do this by using a third-party ODBC driver manager, use the include ODBC driver or the SQL Anywhere driver itself can be configured to act as an ODBC driver manager. However, choosing to use the driver as a driver manager limits you to connecting only to a SQL Anywhere data source.

Using a true driver manager allows you to manage any number of drivers and data sources. Two driver managers that are widely available are unixODBC and iODBC. Instructions for setting up one of these driver managers for use with the SQL Anywhere driver follow.

Driver Managers and SQL Anywhere

Using unixODBC and SQL Anywhere

In order to connect to SQL Anywhere with a DSN, create an .odbc.ini file with the following details:

You can use any standard SQL Anywhere connection string options in this definition, using the name=value pairs.

You can also add a section to odbcinst.ini if you wish to refer to the driver by name:

Performing an ODBC Trace Using unixODBC

An ODBC trace can be performed using unixODBC to help trace ODBC connections. Simply add the following information to the .odbc.ini section entry:

Creating SQL Anywhere Data Sources with the dbdsn Utility

As an alternative to directly editing .odbc.ini to create ODBC data sources,SQL Anywhere includes a data source utility called dbdsn. The following is an example that shows how to use dbdsn:

Sql Anywhere 11 Odbc Driver Download

dbdsn -w 'SQLATestDSN' -c 'uid=dba;pwd=sql;server=myserver;dbn=mydatabase;dbf=/opt/sqlanywhere16/demo.db'

To control which file dbdsn writes to, set the ODBCINI environment variable. For more information about this environment variable, see .odbc.ini and Understanding ODBC data sources.

The dbdsn utility is not an ODBC driver manager. Rather, the Data Source utility is a cross-platform alternative to the ODBC Administrator for creating, deleting, describing, and listing SQL Anywhere ODBC data sources.

Testing ODBC Connections

Testing Acccess to Data Sources Using Interactive SQL

NOTE: dbisql uses JDBC to connect to the database, but can access the DSN information from ODBC

  1. At a command prompt, execute the following command:
    dbisql -c 'dsn=SQL Anywhere 16 Demo'
  2. Execute the following query in Interactive SQL:

    SELECT * FROM department
    The following data appears:

  3. Press F12 to disconnect.
  4. Close Interactive SQL.

Note that it is possible to do the above in one step and with no GUI using the -nogui option in your Interactive SQL command:

dbisql -c 'dsn=SQL Anywhere 16 Demo' -nogui 'SELECT * FROM department'

Building the SQL Anywhere ODBC Sample

NOTE: By default, the ODBC sample is directly linked against the SQL Anywhere ODBC driver. If you would like to change it to use the standard ODBC driver manager on the system, you need to change the target ODBC library in build.sh:
ODBC_LIBS=-ldbodbc${SQLANYVER}
to
ODBC_LIBS=-lodbc

Microsoft Odbc Driver 10 For Sql Server

  1. Ensure you have the required compiler tools installed (GNU or a native compiler).
  2. This sample expects the data source name SQL Anywhere 16 Demo. If you do not have this data source set up on your build machine, you will need to create one. For information about creating this data sources, see above.
  3. Change to the samples directory:
    cd $SQLANY16/samples/sqlanywhere/c
  4. Build the sample using the following command:
    make -f makeall odbc
  5. Run the resulting sample using the following command:
    ./odbc

Configuring the SQL Anywhere ODBC Driver directly as a Driver Manager

You can use the SQL Anywhere ODBC driver as a driver manager on the system if you will only be connecting to SAP SQL Anywhere databases. However, doing this will prevent you from loading any driver other than the SQL Anywhere driver.

To use SQL Anywhere ODBC driver directly as a driver manager, you need to create symbolic links so that ODBC driver manager requests get routed to the SQL Anywhere ODBC driver. From the /opt/sqlanywhere16/lib32 or /opt/sqlanywhere16/lib64 subdirectory, execute the following commands:

cd /opt/sqlanywhere16/lib64
ln -s libdbodbc16.so libodbc.so
ln -s libdbodbc16.so.1 libodbc.so.1

Sql Anywhere 11 Odbc Driver Download

Related Product Documentation