13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

610 Autocommit and Table Types 4 Chapter 21This example connects to MySQL and sends it two EXECUTE statements to process:proc sql;connect to mysql (user=testuser password=testpass server=mysqlservdatabase=mysqldb port=9876);execute (create table whotookorders asselect ordernum, takenby,firstname, lastname, phonefrom orders, employeeswhere orders.takenby=employees.empid)by mysql;execute (grant select on whotookordersto testuser) by mysql;disconnect from mysql;quit;This example per<strong>for</strong>ms a query, shown in highlighted text, on the MySQL tableCUSTOMERS:proc sql;connect to mysql (user=testuser password=testpass server=mysqlservdatabase=mysqldb port=9876);select *from connection to mysql(select * from customerswhere customer like ’1%’);disconnect from mysql;quit;Autocommit and Table TypesMySQL supports several table types, two of which are InnoDB (the default) andMyISAM. A single database can contain tables of different types. The behavior of atable is determined by its table type. For example, by definition, a table created ofMyISAM type does not support transactions. Consequently, all DML statements(updates, deletes, inserts) are automatically committed. If you need transactionalsupport, specify a table type of InnoDB in the DBCREATE_TABLE_OPTS LIBNAMEoption. This table type allows <strong>for</strong> updates, deletes, and inserts to be rolled back if anerror occurs; or updates, deletes, and inserts to be committed if the <strong>SAS</strong> DATA step orprocedure completes successfully.By default, the MYSQL LIBNAME engine sets AUTOCOMMIT=YES regardless of thetable type. If you are using tables of the type InnoDB, set the LIBNAME optionAUTOCOMMIT=NO to improve per<strong>for</strong>mance. To control how often COMMITS areexecuted, set the DBCOMMIT option.Note: The DBCOMMIT option can affect <strong>SAS</strong>/<strong>ACCESS</strong> per<strong>for</strong>mance. Experimentwith a value that best fits your table size and per<strong>for</strong>mance needs be<strong>for</strong>e using it <strong>for</strong>production jobs. Transactional tables require significantly more memory and disk spacerequirements. 4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!