Which of the following problems will plague you during DB2 database compilation?

Source: Internet
Author: User

This article mainly describes the two problems of compiling a DB2 database in C Language). If you compile a DB2 database in C language ), if you are interested, you can click the following article to view it. I hope it will help you in this regard.

DB2 C language compilation, expert

I now have two problems with DB2 compilation in C language)

1. 64-bit Compilation

In makefile, the database linked to db2 points to a 64-bit database, and the CC parameter specifies-q64 for compilation,

Prompt "The typedef definition of wchar_t is incompatible with the option wchar_t_size"

The difference between 32-bit and 64-bit is found. Ignore this error. when running the program, all database variables (sqlca. sqlcode)

A value is a random value. For example, if the error code is-303, it must be-303, but its value is 538976288.

When the makefile library points to 32 and the cc compilation parameter is changed to-q32, the above problem is solved.

Currently, DB2 database compilation must be performed in 64-Bit mode as required. What should I do to solve the above conflicts?

2. Type Mismatch

Define the corresponding macro in the *. h file according to the database table structure. If the field type in the structure is int or long,

When I define the variable type as int, the following error is prompted:

 
 
  1. The token "int" found in a host variable declaration is not valid 

Obviously, this error indicates that int is invalid. Just change it.

When you modify all int type long, the following message is displayed:

 
 
  1. The 'long' host variable "fieldnum" is not valid.Use 'sqlint32' instead。 

Since the current machine is 64-bit, I changed the long type to sqlint32 or sqlint64 in a unified manner. DB2 database compilation passes

However, an error with the error code 303 is prompted during execution, that is, the type does not match:

 
 
  1. SQL0303N A value cannot be assigned to a host variable in the  
  2. SELECT, VALUES, or FETCH statement because the data  
  3. types are not compatible. 

In the hfile, sqlint32 or sqlint64 variables are defined as int type in the database.

The above content is the C language for the compilation of the DB2 database). The DB2 experts can provide a description of the problem and hope to help you in this regard.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.