A segmentation violation occurs when you are using SAS/ACCESS® Interface to DB2 and running code against a DB2 database


When querying a DB2 database with SAS/ACCESS Interface to DB2, you might receive a segmentation violation error like the following:

ERROR: An exception has been encountered.
Please contact technical support and provide them with the following traceback information:

The SAS task name is <task used> Segmentation Violation
Traceback of the Exception:
 
/opt/sas94/bin/SASFoundation/9.4/sasexe/sas() [0x525d1e]
/opt/sas94/bin/SASFoundation/9.4/sasexe/sas() [0x41ebee]
/opt/sas94/bin/SASFoundation/9.4/sasexe/tkmk.so(bkt_signal_handler+0x144) [0x2ad41a1b9514]
/lib64/libpthread.so.0() [0x31a540f710]
/opt/sas94/bin/SASFoundation/9.4/sasexe/tkmk.so(skm_free_container+0x8) [0x2ad41a1cbf88] /opt/sas94/bin/SASFoundation/9.4/sasexe/tkmk.so(skm_release_large_chunk+0x3e) [0x2ad41a1ca61e] /opt/sas94/bin/SASFoundation/9.4/sasexe/sasxdbi(dbifbf+0x39) [0x2ad477f6d099] /opt/sas94/bin/SASFoundation/9.4/sasexe/sasxdbi(dbifopn+0x20) [0x2ad477f7bd60] /opt/sas94/bin/SASFoundation/9.4/sasexe/sasxdbi(yoeclos+0x317) [0x2ad477f4a607] /opt/sas94/bin/SASFoundation/9.4/sasexe/sasyoio(yoclose+0x9bd) [0x2ad471554f6d] /opt/sas94/bin/SASFoundation/9.4/sasexe/sasiomet(yoeclos+0x11a) [0x2ad47765f15a] /opt/sas94/bin/SASFoundation/9.4/sasexe/sasyoio(yoclose+0x9bd) [0x2ad471554f6d] /opt/sas94/bin/SASFoundation/9.4/sasexe/sasyh(yorclnp+0x4f9) [0x2ad429b88109] /opt/sas94/bin/SASFoundation/9.4/sasexe/sasyh(yhcstep+0x18) [0x2ad429b7dd68] /opt/sas94/bin/SASFoundation/9.4/sasexe/sasxkern(yakrext+0x327) [0x2ad42924d167]
/opt/sas94/bin/SASFoundation/9.4/sasexe/sas() [0x413da5]
/opt/sas94/bin/SASFoundation/9.4/sasexe/sas() [0x4110a6]
/opt/sas94/bin/SASFoundation/9.4/sasexe/sas(wtdelet+0x48) [0x411438]
/opt/sas94/bin/SASFoundation/9.4/sasexe/sasds(sasds+0x39e) [0x2ad4654be23e]
/opt/sas94/bin/SASFoundation/9.4/sasexe/sas(vvtentr+0x101) [0x41e801]
/lib64/libpthread.so.0() [0x31a54079d1] /lib64/libc.so.6(clone+0x6d) [0x31a50e8b6d]

 

The error occurs if the DB2 encoding is not set properly. To determine the DB2 encoding used on the DB2 server, run this query in the DB2 Command Line Processor:

      select codepage from syscat.datatypes where typename='varchar';

The query returns a number. Use that number as the value for the DB2CODEPAGE environment variable.

Another way to resolve the error is to set the SAS_ACCESS_PIPELINEREAD=OFF environment variable. However, this affects all SAS/ACCESS products by turning off pipeline reads. Pipeline reads were added to SAS® 9.4. By turning off pipeline reads, data reads are performed the way they were in previous SAS releases.