SQL Anywhere® Server Programming

SQL Anywhere® Server Programming

SQL Anywhere® Server Programming Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 Copyright © 2010 iAnywhere Solutions, Inc. Portions copyright © 2010 Sybase, Inc. All rights reserved. This documentation is provided AS IS, without warranty or liability of any kind (unless provided by a separate written agreement between you and iAnywhere). You may use, print, reproduce, and distribute this documentation (in whole or in part) subject to the following conditions: 1) you must retain this and all other proprietary notices, on all copies of the documentation or portions thereof, 2) you may not modify the documentation, 3) you may not do anything to indicate that you or anyone other than iAnywhere is the author or source of the documentation. iAnywhere®, Sybase®, and the marks listed at http://www.sybase.com/detail?id=1011207 are trademarks of Sybase, Inc. or its subsidiaries. ® indicates registration in the United States of America. All other company and product names mentioned may be trademarks of the respective companies with which they are associated. Contents About this book .................................................................................... ix About the SQL Anywhere documentation ........................................................ ix Using SQL in applications .................................................................... 1 Executing SQL statements in applications ....................................................... 1 Preparing statements .......................................................................................... 2 Introduction to cursors ....................................................................................... 5 Working with cursors .......................................................................................... 8 Choosing cursor types ...................................................................................... 14 SQL Anywhere cursors ..................................................................................... 16 Describing result sets ....................................................................................... 33 Controlling transactions in applications ......................................................... 34 .NET application programming .......................................................... 39 SQL Anywhere .NET Data Provider .................................................................. 39 Tutorial: Using the SQL Anywhere .NET Data Provider ................................. 71 SQL Anywhere ASP.NET Providers ................................................................. 78 Tutorial: Developing a simple .NET database application with Visual Studio .................................................................................................................. 86 SQL Anywhere .NET API reference .................................................................. 94 OLE DB and ADO development ........................................................ 327 Introduction to OLE DB ................................................................................... 327 ADO programming with SQL Anywhere ........................................................ 328 OLE DB Connection Pooling .......................................................................... 334 Setting up a Microsoft Linked Server using OLE DB ................................... 335 Supported OLE DB interfaces ........................................................................ 337 ODBC support .................................................................................... 343 Requirements for developing ODBC applications ....................................... 343 Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 iii SQL Anywhere® Server - Programming Building ODBC applications ........................................................................... 345 ODBC samples ................................................................................................. 350 ODBC handles .................................................................................................. 351 Choosing an ODBC connection function ...................................................... 354 Server options changed by ODBC ................................................................. 357 SQLSetConnectAttr extended connection attributes ................................... 358 Calling SQLFreeEnv ........................................................................................ 360 Executing SQL statements ............................................................................. 360 64-bit ODBC considerations ........................................................................... 364 Data alignment requirements ......................................................................... 368 Working with result sets ................................................................................. 369 Calling stored procedures .............................................................................. 374 Handling errors ................................................................................................ 375 Java in the database .......................................................................... 379 Learning about Java in the database ............................................................. 379 Java in the database Q & A ............................................................................. 380 Java error handling ......................................................................................... 382 Creating a Java class for use with SQL Anywhere ...................................... 382 Choosing a Java VM ........................................................................................ 384 Install the sample Java class .......................................................................... 385 Using the CLASSPATH variable ..................................................................... 386 Accessing methods in the Java class ........................................................... 386 Accessing fields and methods of the Java object ........................................ 387 Installing Java classes into a database ......................................................... 389 Special features of Java classes in the database ......................................... 393 Starting and stopping the Java VM ................................................................ 396 JDBC support ..................................................................................... 397 JDBC applications ........................................................................................... 397 Choosing a JDBC driver ................................................................................. 398 JDBC program structure ................................................................................. 400 Differences between client- and server-side JDBC connections ................ 400 Using a SQL Anywhere JDBC driver ............................................................. 401 iv Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 SQL Anywhere® Server - Programming Using the jConnect JDBC driver .................................................................... 402 Connecting from a JDBC client application .................................................. 406 Using JDBC to access data ............................................................................ 413 Using JDBC callbacks ..................................................................................... 421 Using JDBC escape syntax ............................................................................ 425 JDBC 3.0/4.0 API support ................................................................................ 428 Embedded SQL .................................................................................. 429 Development process overview ..................................................................... 430 Running the SQL preprocessor ..................................................................... 431 Supported compilers ....................................................................................... 431 Embedded SQL header files ........................................................................... 431 Import libraries ................................................................................................. 432 Sample embedded SQL program ................................................................... 433 Structure of embedded SQL programs ......................................................... 433 Loading DBLIB dynamically under Windows ............................................... 434 Sample embedded SQL programs ................................................................. 435 Embedded SQL data types ............................................................................. 439 Using host variables ........................................................................................ 442 The SQL Communication Area (SQLCA) ....................................................... 451 Static and dynamic SQL .................................................................................. 456 The SQL descriptor area (SQLDA) ................................................................. 460 Fetching data ................................................................................................... 469 Sending

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1076 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us