/usr/share/doc/libhsqldb-java-doc/guide/management-chapt.html is in libhsqldb-java-doc 2.2.9+dfsg-4ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 | <html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Chapter 11. System Management</title>
<link href="../docbook.css" type="text/css" rel="stylesheet">
<meta content="DocBook XSL Stylesheets V1.77.1" name="generator">
<meta name="keywords" content="Hsqldb, HyperSQL, SQL">
<meta name="keywords" content="Hsqldb, HyperSQL, Database, JDBC, Java">
<link rel="home" href="index.html" title="HyperSQL User Guide">
<link rel="up" href="index.html" title="HyperSQL User Guide">
<link rel="prev" href="builtinfunctions-chapt.html" title="Chapter 10. Built In Functions">
<link rel="next" href="dbproperties-chapt.html" title="Chapter 12. Properties">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table summary="Navigation header" width="100%">
<tr>
<td align="left" width="30%"><a accesskey="p" href="builtinfunctions-chapt.html"><img src="../images/db/prev.png" alt="Prev"></a> </td><td align="center" width="40%" style="font-weight:bold;">Chapter 11. System Management</td><td align="right" width="30%"> <a accesskey="n" href="dbproperties-chapt.html"><img src="../images/db/next.png" alt="Next"></a></td>
</tr>
<tr>
<td valign="top" align="left" width="30%">Chapter 10. Built In Functions </td><td align="center" width="40%"><a accesskey="h" href="index.html"><img src="../images/db/home.png" alt="Home"></a></td><td valign="top" align="right" width="30%"> Chapter 12. Properties</td>
</tr>
</table>
</div>
<HR>
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title">
<a name="management-chapt"></a>Chapter 11. System Management</h1>
</div>
<div>
<div class="authorgroup">
<div class="author">
<h3 class="author">
<span class="firstname">Fred</span> <span class="surname">Toussi</span>
</h3>
<div class="affiliation">
<span class="orgname">The HSQL Development Group<br>
</span>
</div>
</div>
</div>
</div>
<div>
<p class="releaseinfo">$Revision: 5039 $</p>
</div>
<div>
<div class="legalnotice">
<a name="N1408E"></a>
<p>Copyright 2002-2012 Fred Toussi. Permission is granted to
distribute this document without any alteration under the terms of the
HSQLDB license. Additional permission is granted to the HSQL Development
Group to distribute this document with or without alterations under the
terms of the HSQLDB license.</p>
</div>
</div>
<div>
<p class="pubdate">2012-08-06 00:10:58+0100</p>
</div>
</div>
</div>
<div class="toc">
<p>
<b>Table of Contents</b>
</p>
<dl>
<dt>
<span class="section"><a href="management-chapt.html#mtc_modes_tables">Mode of Operation and Tables</a></span>
</dt>
<dd>
<dl>
<dt>
<span class="section"><a href="management-chapt.html#mtc_modes_operation">Mode of Operation</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_table_types">Tables</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_large_objects">Large Objects</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_deploy_context">Deployment context</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_readonly_database">Readonly Databases</a></span>
</dt>
</dl>
</dd>
<dt>
<span class="section"><a href="management-chapt.html#mtc_acid_persistence">ACID, Persistence and Reliability</a></span>
</dt>
<dd>
<dl>
<dt>
<span class="section"><a href="management-chapt.html#mtc_acid">Atomicity, Consistency, Isolation, Durability</a></span>
</dt>
</dl>
</dd>
<dt>
<span class="section"><a href="management-chapt.html#mtc_backup">Backing Up Database Catalogs</a></span>
</dt>
<dd>
<dl>
<dt>
<span class="section"><a href="management-chapt.html#mtc_online_backup">Making Online Backups</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_offline_backup">Making Offline Backups</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_listing_backup">Examining Backups</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_restoring_backup">Restoring a Backup</a></span>
</dt>
</dl>
</dd>
<dt>
<span class="section"><a href="management-chapt.html#mtc_encrypted_database">Encrypted Databases</a></span>
</dt>
<dd>
<dl>
<dt>
<span class="section"><a href="management-chapt.html#mtc_encrypted_create">Creating and Accessing an Encrypted Database</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_encrypted_speed">Speed Considerations</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_encrypted_security">Security Considerations</a></span>
</dt>
</dl>
</dd>
<dt>
<span class="section"><a href="management-chapt.html#mtc_monitoring_operation">Monitoring Database Operations</a></span>
</dt>
<dd>
<dl>
<dt>
<span class="section"><a href="management-chapt.html#mtc_external_monitoring">External Statement Level Monitoring</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_internal_monitoring">Internal Statement Level Monitoring</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_internal_event_monitoring">Internal Event Monitoring</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#N14213">Log4J and JDK logging</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_server_monitoring">Server Operation Monitoring</a></span>
</dt>
</dl>
</dd>
<dt>
<span class="section"><a href="management-chapt.html#mtc_database_security">Database Security</a></span>
</dt>
<dd>
<dl>
<dt>
<span class="section"><a href="management-chapt.html#mtc_security_defaults">Security Defaults</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_authentication_control">Authentication Control</a></span>
</dt>
</dl>
</dd>
<dt>
<span class="section"><a href="management-chapt.html#mtc_compatibility_other">Compatibility with Other RDBMS</a></span>
</dt>
<dd>
<dl>
<dt>
<span class="section"><a href="management-chapt.html#mtc_compatibility_postgres">PostgreSQL Compatibility</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_compatibility_mysql">MySQL Compatibility</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_compatibility_firebird">Firebird Compatibility</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_compatibility_derby">Apache Derby Compatibility</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_compatibility_oracle">Oracle Compatibility</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_compatibility_db2">DB2 Compatibility</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_compatibility_mssql">MS SQLServer and Sybase Compatibility</a></span>
</dt>
</dl>
</dd>
<dt>
<span class="section"><a href="management-chapt.html#mtc_statements">Statements</a></span>
</dt>
<dd>
<dl>
<dt>
<span class="section"><a href="management-chapt.html#mtc_system_operations">System Operations</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_database_settings">Database Settings</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_sql_settings">SQL Conformance Settings</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_cache_persistence">Cache, Persistence and Files Settings</a></span>
</dt>
<dt>
<span class="section"><a href="management-chapt.html#mtc_authntication_settings">Authentication Settings</a></span>
</dt>
</dl>
</dd>
</dl>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a name="mtc_modes_tables"></a>Mode of Operation and Tables</h2>
</div>
</div>
</div>
<p>HyperSQL has many modes of operation and features that allow it to
be used in very different scenarios. Levels of memory usage, speed and
accessibility by different applications are influenced by how HyperSQL is
deployed.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_modes_operation"></a>Mode of Operation</h3>
</div>
</div>
</div>
<p>The decision to run HyperSQL as a separate server process or as an
<em class="glossterm">in-process</em> database should be based on the
following:</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>When HyperSQL is run as a server on a separate machine, it
is isolated from hardware failures and crashes on the hosts
running the application.</p>
</li>
<li class="listitem">
<p>When HyperSQL is run as a server on the same machine, it is
isolated from application crashes and memory leaks.</p>
</li>
<li class="listitem">
<p>Server connections are slower than
<em class="glossterm">in-process</em> connections due to the overhead
of streaming the data for each JDBC call.</p>
</li>
<li class="listitem">
<p>You can reduce client/server traffic using SQL Stored
procedures to reduce the number of JDBC execute calls.</p>
</li>
<li class="listitem">
<p>During development, it is better to use a Server with
server.silent=false, which displays the statements sent to the
server on the console window.</p>
</li>
<li class="listitem">
<p>To improve speed of execution for statements that are
executed repeatedly, reuse a parameterized PreparedStatement for
the lifetime of the connections.</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_table_types"></a>Tables</h3>
</div>
</div>
</div>
<p>TEXT tables are designed for special applications where the data
has to be in an interchangeable format, such as CSV (comma separated
values). TEXT tables should not be used for routine storage of
data.</p>
<p>MEMORY tables and CACHED tables are generally used for data
storage. The difference between the two is as follows:</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>The data for all MEMORY tables is read from the *.script
file when the database is started and stored in memory. In
contrast the data for cached tables is not read into memory until
the table is accessed. Furthermore, only part of the data for each
CACHED table is held in memory, allowing tables with more data
than can be held in memory.</p>
</li>
<li class="listitem">
<p>When the database is shutdown in the normal way, all the
data for MEMORY tables is written out to the disk. In comparison,
the data in CACHED tables that has changed is written out during
operation and at shutdown.</p>
</li>
<li class="listitem">
<p>The size and capacity of the data cache for all the CACHED
tables is configurable. This makes it possible to allow all the
data in CACHED tables to be cached in memory. In this case, speed
of access is good, but slightly slower than MEMORY tables.</p>
</li>
<li class="listitem">
<p>For normal applications it is recommended that MEMORY tables
are used for small amounts of data, leaving CACHED tables for
large data sets. For special applications in which speed is
paramount and a large amount of free memory is available, MEMORY
tables can be used for large tables as well.</p>
</li>
<li class="listitem">
<p>You can change the type of the table with the <code class="literal">SET
TABLE <table name> TYPE { CACHED | MEMORY
}</code>statement.</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_large_objects"></a>Large Objects</h3>
</div>
</div>
</div>
<p>HyperSQL 2.0 supports dedicated storage and access to BLOB and
CLOB objects. These objects can have huge sizes. BLOB or CLOB is
specified as the type of a column of the table. Afterwards, rows can be
inserted into the table using a PreparedStatement for efficient transfer
of large LOB data to the database. In <em class="glossterm">mem:</em>
catalogs, CLOB and BLOB data is stored in memory. In
<em class="glossterm">file:</em> catalogs, this data is stored in a single
separate file which has the extension *.lobs. The size of this file can
grow to huge, terabyte figures. By default, a minimum 32 KB is allocated
to each LOB. You can reduced this if your LOBs are generally
smaller.</p>
<p>LOB data should be store in the database using a JDBC
PreparedStatement object. The streaming methods send the LOB to the
database in one operation as a binary or character stream. Inside the
database, the disk space is allocated as needed and the data is saved as
it is being received. LOB data should be retrieved from the database
using a JDBC ResultSet method. When a streaming method is used to
retrieve a LOB, it is retrieved in large chunks in a transparent manner.
LOB data can also be retrieved as String or byte[], but these methods
use more memory and may not be practical for large objects.</p>
<p>LOB data is not duplicated in the database when a lob is copied
from one table to another. The disk space is reused when a LOB is
deleted and is no longer contained in any table. This happens only at
the time of a CHECKPOINT.</p>
<p>By using a dedicated LOB store, HyperSQL achieves consistently
high speeds (usually over 20MB / s) for both storage and retrieval of
LOBs.</p>
<p>There is an internal LOBS schema in the database to store the
id's, sizes and addresses of the LOBs (but not the actual LOBS) in a few
system tables. This schema is stored in the database as MEMORY tables.
Therefore the amount of JVM memory should be increased when more than
tens of thousands of LOBs are stored in the database. If your database
contains more than a few hundreds of thousands of LOBs and memory use
becomes an issue, you can change one or all LOB schema tables to CACHED
tables. See statements below:</p>
<div class="example">
<a name="N140E7"></a>
<p class="title">
<b>Example 11.1. Using CACHED tables for the LOB schema</b>
</p>
<div class="example-contents">
<pre class="screen"> SET TABLE SYSTEM_LOBS.BLOCKS TYPE CACHED
SET TABLE SYSTEM_LOBS.LOBS TYPE CACHED
SET TABLE SYSTEM_LOBS.LOB_IDS TYPE CACHED
</pre>
</div>
</div>
<br class="example-break">
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_deploy_context"></a>Deployment context</h3>
</div>
</div>
</div>
<p>The files used for storing HyperSQL database data are all in the
same directory. New files are always created and deleted by the database
engine. Two simple principles must be observed:</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>The Java process running HyperSQL must have full privileges on
the directory where the files are stored. This include create and
delete privileges.</p>
</li>
<li class="listitem">
<p>The file system must have enough spare room both for the
'permanent' and 'temporary' files. The default maximum size of the
*.log file is 50MB. The *.data file can grow to up to 16GB (more if
the default has been increased). The .backup file can be up to the
size of the *.data file. The *.lobs file can grow to several
terabytes. The temporary files created at the time of a SHUTDOWN can
be equal in size to the *.script file and the .data file.</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_readonly_database"></a>Readonly Databases</h3>
</div>
</div>
</div>
<p>A <em class="glossterm">file:</em> catalog can be made readonly
permanently, or it can be opened as readonly. To make the database
readonly, the property, value pair, <code class="literal">readonly=true</code> can
be added to the <code class="filename">.properties</code> file of the
database.</p>
<p>It is also possible to open a normal database as readonly. For
this, the property can be included in the URL of the first connection to
the database.</p>
<p>There is another option which allows MEMORY tables to be
writeable, but without persisting the changes at SHUTDOWN. This option
is activated with the property, value pair,
<code class="literal">files_readonly=true</code>, which can be added to the
<code class="filename">.properties</code> file of the database, or included in
the URL of the first connection to the database. This option is useful
for running application tests which operate on a predefined
dataset.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a name="mtc_acid_persistence"></a>ACID, Persistence and Reliability</h2>
</div>
</div>
</div>
<p>HyperSQL 2.0 uses the same persistence mechanism as version 1.8, but
with important enhancements. The code has proven reliable, as the last
critical issue was fixed 2 years before the release of version 2.0.</p>
<p>There are further enhancements in version 2.2</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>More extensive locking mechanism has been added to code to
support multithreaded access.</p>
</li>
<li class="listitem">
<p>Incremental backup (an internal mechanism for crash protection)
allows fast checkpoint and shutdown.</p>
</li>
<li class="listitem">
<p>All files are synced at checkpoints and also just before
closing.</p>
</li>
<li class="listitem">
<p>The data file is enlarged in block increments</p>
</li>
<li class="listitem">
<p>The NIO file access implementation has been improved</p>
</li>
</ul>
</div>
<p>Persistence relies on the JVM, the operating system, and the
computer hardware. A database system like HSQLDB can perform millions of
read and write operations in an hour. As system hardware and software can
go wrong, it is impossible to achieve zero failure rate. Therefore regular
backups are recommended. HyperSQL 2.2 has built-in database backup and
restore features, discussed elsewhere in this chapter.</p>
<p>A note regarding the NIO file access implementation: This
implementation applies only to CACHED table data in the
<code class="literal">.data</code> file. Other files are not accessed via NIO. There
has been an issue with some JVM implementations of nio not releasing the
file buffers after they were closed. HyperSQL uses a workaround which is
recommended for Sun JVM's. This does not apply to other JVM's. In such
environments, it is therefore recommended to test the CHECKPOINT DEFRAG
operation and the shutting down and restarting the database inside the
same Java process extensively with NIO. Use of NIO can be turned off if
necessary.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_acid"></a>Atomicity, Consistency, Isolation, Durability</h3>
</div>
</div>
</div>
<p>Atomicity means a transaction either fails without changing the
data, or succeeds. HyperSQL ensures atomicity both during operations and
in the event of a system crash.</p>
<p>Consistency means all the implicit and explicit integrity
constraints are always enforced. HyperSQL always enforces the
constraints and at the same time does not allow unenforceable
constraints (illegal forms of CHECK constraints) to be created.</p>
<p>Isolation means transactions do not interfere with each other.
HyperSQL enforces isolation according to strict rules of the database
isolation model (MVCC or LOCKS).</p>
<p>Durability means a committed transaction is protected in case of a
system crash. HyperSQL ensures durability according to the setting for
WRITE DELAY MILLIS. A zero delay setting results in an
FileDescriptor#sync() call each time a transaction commits. A timed
delay means the FileDescriptor#sync() call is executed in the given
intervals and only the last transactions committed in the interval may
be lost. The sync() call is also made at all critical points, including
when a file is about to be closed. Durability of files requires a
reliable JVM and disk storage system that stores the data safely with a
sync() call. In practice, many systems are generally reliable in this
respect.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a name="mtc_backup"></a>Backing Up Database Catalogs</h2>
</div>
</div>
</div>
<a name="N14141" class="indexterm"></a>
<p>The database engine saves the files containing all the data in a
file catalog when a shutdown takes place. It automatically recovers from
an abnormal termination and preserves the data when the catalog is opened
next time. In an ideal operating environment, where there is no OS crash,
disk failure, bugs in code, etc. there would be no need regularly to
backup a database. This is meant to say, the engine performs the routine
shutdown procedure internally, therefore backing up catalogs is an
insurance policy against all sorts of misadventure that are not under the
control of the database engine.</p>
<p>The data for each catalog consists of up to 5 files in the same
directory with the endings such as <code class="literal">*.properties</code>,
<code class="literal">*.script</code>, etc., as detailed in previous
chapters.</p>
<p>HyperSQL 2.2 includes commands to backup the database files into
a single <code class="literal">.tar</code> or <code class="literal">.tar.gz</code> file
archive. The backup can be performed by a command given in a JDBC session
if the target database catalog is running, or on the command-line if the
target catalog has been shutdown.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_online_backup"></a>Making Online Backups</h3>
</div>
</div>
</div>
<p>To back up a running catalog, obtain a JDBC connection and
issue a <code class="literal">BACKUP DATABASE</code> command in SQL. In its most
simple form, the command format below will backup the database as a
single <code class="literal">.tar.gz</code> file to the given directory.</p>
<pre class="programlisting"> BACKUP DATABASE TO <directory name> BLOCKING</pre>
<p>The <span class="emphasis"><em>directory name</em></span> must end with a slash
to distinguish it as a directory, and the whole string must be in single
quotes like so: <code class="literal">'subdir/nesteddir/'</code>.</p>
<p>See the next section under Statements for details about the
command and its options. See the sections below about restoring a
backup.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_offline_backup"></a>Making Offline Backups</h3>
</div>
</div>
</div>
<p>To back up an offline catalog, the catalog must be in shut down
state. You will run a Java command like this. In this example, the
database is named dbname and is in the dbdir directory. The backup is
saved to a file named backup.tar in the tardir directory.</p>
<div class="example">
<a name="N14175"></a>
<p class="title">
<b>Example 11.2. Offline Backup Example</b>
</p>
<div class="example-contents">
<pre class="screen"> java -cp hsqldb.jar org.hsqldb.lib.tar.DbBackup --save tardir/backup.tar dbdir/dbname</pre>
</div>
</div>
<p>
<br class="example-break">where <code class="filename">tardir/backup.tar</code> is a file path
to the <code class="literal">*.tar</code> or <code class="literal">*.tar.gz</code> file to
be created in your file system, and <code class="filename">dbdir/dbname</code> is
the file path to the catalog file base name (in same fashion as in
<code class="varname">server.database.*</code> settings and JDBC URLs with catalog
type <em class="glossterm">file:</em>.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_listing_backup"></a>Examining Backups</h3>
</div>
</div>
</div>
<p>You can list the contents of backup tar files with
<code class="classname">DbBackup</code> on your operating system command line,
or with any Pax-compliant tar or pax client (this includes GNU tar),
</p>
<div class="example">
<a name="N14196"></a>
<p class="title">
<b>Example 11.3. Listing a Backup with DbBackup</b>
</p>
<div class="example-contents">
<pre class="screen"> java -cp hsqldb.jar org.hsqldb.lib.tar.DbBackup --list tardir/backup.tar</pre>
</div>
</div>
<p>
<br class="example-break">You can also give regular expressions at the end of the
command line if you are only interested in some of the file entries in
the backup. Note that these are real regular expressions, not shell
globbing patterns, so you would use <code class="literal">.+script</code> to match
entries ending in "script", not <code class="literal">*script</code>.</p>
<p>You can examine the contents of the backup in their entirety by
restoring the backup, as explained in the following section, to a
temporary directory.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_restoring_backup"></a>Restoring a Backup</h3>
</div>
</div>
</div>
<p>You use <code class="classname">DbBackup</code> on your operating system
command line to restore a catalog from a backup. </p>
<div class="example">
<a name="N141AD"></a>
<p class="title">
<b>Example 11.4. Restoring a Backup with DbBackup</b>
</p>
<div class="example-contents">
<pre class="screen"> java -cp hsqldb.jar org.hsqldb.lib.tar.DbBackup --extract tardir/backup.tar dbdir</pre>
</div>
</div>
<p>
<br class="example-break">where <code class="filename">tardir/backup.tar</code> is a file path
to the *.tar or *.tar.gz file to be read, and <code class="filename">dbdir</code>
is the target directory to extract the catalog files into. Note that
<code class="filename">dbdir</code> specifies a directory path, without the
catalog file base name. The files will be created with the names stored
in the tar file (and which you can see as described in the preceding
section).</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a name="mtc_encrypted_database"></a>Encrypted Databases</h2>
</div>
</div>
</div>
<p>HyperSQL supports encrypted databases. Encryption services use the
Java Cryptography Extensions (JCE) and uses the ciphers installed with the
JRE. HyperSQL itself does not contain any cryptography code.</p>
<p>Three elements are involved in specifying the encryption method and
key. A cipher, together with its configuration is identified by a string
which includes the name of the cipher and optional parameters. A provider
is the fully qualified class name of the cipher provider. A key is
represented as a hexadecimal string.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_encrypted_create"></a>Creating and Accessing an Encrypted Database</h3>
</div>
</div>
</div>
<p>First, a key must be created for the desired cipher and
configuration. This is done by calling the function CRYPT_KEY(<cipher
spec>, <provider>). If the default provider (the built-in JVM
ciphers) is used, then NULL should be specified as the provider. The
CRYPT_KEY function returns a hexadecimal key. The function call can be
made in any HyperSQL database, so long as the provider class is on the
classpath. This key can be used to create a new encrypted database.
Calls to this function always return different keys, based on a
generated random values.</p>
<p>As an example, a call to CRYPT_KEY('Blowfish', null) returned the
string, '604a6105889da65326bf35790a923932'. To create a new database,
the URL below is used:</p>
<p>
<code class="literal">jdbc:hsqldb:file:<database
path>;crypt_key=604a6105889da65326bf35790a923932;crypt_type=blowfish</code>
</p>
<p>The third property name is crypt_provider. This is specified only
when the provider is not the default provider.</p>
<p>HyperSQL works with any symmetric cipher that may be available
from the JVM.</p>
<p>The files that are encrypted include the .script, .data, .backup
and .log files. The .lobs file is not encrypted by default. The property
crypt_lobs=true must be specified to encrypt the .lobs file.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_encrypted_speed"></a>Speed Considerations</h3>
</div>
</div>
</div>
<p>General operations on an encrypted database are performed the same
as with any database. However, some operations are significantly slower
than with the equivalent cleartext database. With MEMORY tables, there
is no difference to the speed of SELECT statements, but data change
statements are slower. With CACHED tables, the speed of all statements
is slower.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_encrypted_security"></a>Security Considerations</h3>
</div>
</div>
</div>
<p>Security considerations for encrypted databases have been
discussed at length in HSQLDB discussion groups. Development team
members have commented that encryption is not a panacea for all security
needs. The following issues should be taken into account:</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>Encrypted files are relatively safe in transport, but
because databases contain many repeated values and words,
especially known tokens such as CREATE, INSERT, etc., breaking the
encryption of a database may be simpler than an unknown
file.</p>
</li>
<li class="listitem">
<p>Only the files are encrypted, not the memory image. Poking
into computer memory, while the database is open, will expose the
contents of the database.</p>
</li>
<li class="listitem">
<p>HyperSQL is open source. Someone who has the key, can
compile and use a modified version of the program that saves a
full cleartext dump of an encrypted database</p>
</li>
</ul>
</div>
<p>Therefore encryption is generally effective only when
the users who have access to the crypt key are trusted.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a name="mtc_monitoring_operation"></a>Monitoring Database Operations</h2>
</div>
</div>
</div>
<p>Database operations can be monitored at different levels using
internal HyperSQL capabilities or add-ons.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_external_monitoring"></a>External Statement Level Monitoring</h3>
</div>
</div>
</div>
<p>Statement level monitoring allows you to gather statistics about
executed statements. HyperSQL is supported by the monitoring tool JAMon
(Java Application Monitor). JAMon is currently developed as the
SourceForge project, jamonapi.</p>
<p>JAMon works at the JDBC level. It can monitor and gather
statistics on different types of executed statements or other JDBC
calls.</p>
<p>Early versions of JAMon were developed with HSQLDB and had to be
integrated into HSQLDB at code level. The latest versions can be added
on as a proxy in a much simpler fashion.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_internal_monitoring"></a>Internal Statement Level Monitoring</h3>
</div>
</div>
</div>
<p>The internally-generated, individual sql log for the database can
be enabled with the <code class="literal">SET DATABASE EVENT LOG SQL LEVEL</code>
statement, described in this chapter. As all the executed statements are
logged, there is an impact on speed. So you should only use this for
debugging. Two levels of sql logging are supported.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_internal_event_monitoring"></a>Internal Event Monitoring</h3>
</div>
</div>
</div>
<p>HyperSQL can log important internal events of the engine. These
events occur during the operation of the engine, and are not always
coupled with the exact type of statement being executed. Normal events
such as opening and closing of files, or errors such as OutOfMemory
conditions are examples of logged events.</p>
<p>HyperSQL supports two methods of logging. One method is specific
to the individual database and is managed internally by HyperSQL. The
other method is specific to JVM and is managed by a logging
framework.</p>
<p>The internally-generated, individual log for the database can be
enabled with the <code class="literal">SET DATABASE EVENT LOG LEVEL</code>
statement, described in this chapter. This method of logging is very
useful for desktop application deployment, as it provides an ongoing
record of database operations.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="N14213"></a>Log4J and JDK logging</h3>
</div>
</div>
</div>
<p>HyperSQL also supports log4J and JDK logging. The same event
information that is passed to the internal log, is passed to external
logging frameworks. These frameworks are typically configured outside
HyperSQL. The log messages include the string "hsqldb.db." followed by
the unique id (a 16 character string) of the database that generated the
message, so they can be identified in a multi-database server
context.</p>
<p>As the default JDK logging framework has several shortcomings,
HyperSQL configures this logging framework for better operation. If you
do not want HyperSQL to configure the JDK logging framework, you should
include the system level property
<code class="literal">hsqldb.reconfig_logging=false</code> in your
environment.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_server_monitoring"></a>Server Operation Monitoring</h3>
</div>
</div>
</div>
<p>A Server or WebServer instance can be started with the property
server.silent=false. This causes all the connections and their executed
statements to be printed to stdout as the statements are submitted to
the server.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a name="mtc_database_security"></a>Database Security</h2>
</div>
</div>
</div>
<p>HyperSQL has extensive security features which are implemented at
different levels and covered in different chapters of this guide.</p>
<div class="orderedlist">
<ol class="orderedlist" type="1">
<li class="listitem">
<p>The server can use SSL and IP address access control lists. See
the <a class="link" href="listeners-chapt.html" title="Chapter 13. HyperSQL Network Listeners (Servers)">HyperSQL Network Listeners
(Servers)</a> chapter.</p>
</li>
<li class="listitem">
<p>You can define a system property to stop the database engine
accessing the Java static functions that are on the classpath, apart
from a limited set that you allow. See Securing Access to Classes in
the <a class="link" href="sqlroutines-chapt.html" title="Chapter 8. SQL-Invoked Routines">SQL-Invoked Routines</a> chapter.</p>
</li>
<li class="listitem">
<p>You can define a system property to allow access to files on the
file system outside the database directory and its children. This
access is only necessary if you use TEXT tables. See the <a class="link" href="texttables-chapt.html" title="Chapter 5. Text Tables">Text Tables</a>
chapter.</p>
</li>
<li class="listitem">
<p>The database files can be encrypted. Discussed in this
chapter.</p>
</li>
<li class="listitem">
<p>Within the database, the DBA privileges are required for system
and maintenance jobs.</p>
</li>
<li class="listitem">
<p>You can define users and roles and grant them access on
different database objects. Each user has a password and is granted a
set of privileges. See the <a class="link" href="accesscontrol-chapt.html" title="Chapter 6. Access Control">Access Control</a> chapter.</p>
</li>
<li class="listitem">
<p>You can define a password complexity check function for new and
changed passwords. This is covered below under Authentication
Settings.</p>
</li>
<li class="listitem">
<p>You can use external authentication instead of internally stored
password to authenticate users for each database. This is covered
below under Authentication Settings.</p>
</li>
</ol>
</div>
<p>HyperSQL security is multi-layered and avoids any loopholes to
circumvent security. It is however the user's responsibility to enable the
required level of security.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_security_defaults"></a>Security Defaults</h3>
</div>
</div>
</div>
<p>The default setting are generally adequate for most embedded use
of the database or for servers on the host that are accessed from the
same machine. For servers accessed within a network, and especially for
those accessed from outside the network, additional security settings
must be used.</p>
<p>The default settings for server and web server do not use SSL or
IP access control lists. These features are enabled programatically, or
with the properties used to start the server.</p>
<p>The default settings allow a database user with the DBA role or
with schema creation role to access static functions on the classpath.
You can disable this feature or limit it to specific classes and
methods. This can be done programatically or by setting a system
property when you start a server.</p>
<p>If access to specific static functions is granted, then these
functions must be considered as part of the database program and checked
for any security flaws before inclusion in the classpath.</p>
<p>The default settings do not allow a user to access files outside
the database directory. This access is for TEXT table source files. You
can override this programatically or with a system property when you
start a server.</p>
<p>The encryption of database file does not utilise any user-supplied
information for encryption keys. This level of security is outside the
realm of users and passwords.</p>
<p>The first user for a new database has the DBA role. This user name
need was always SA in older versions of HSQLDB, but not in the latest
versions. The name of the first DBA user and its password can be
specified when the database is created by the first connection to the
database. These settings are then stored in the database.</p>
<p>The initial user with the DBA role should be used for admin
purposes only. At least one additional role should be created for normal
database use in the application and at least one additional user should
be created and granted this role. The new role should not be given the
DBA role. It can be given the CREATE_SCHEMA role, which allows it to
create and access multiple schemas. Alternatively, the user with the DBA
role can create the schemas and their objects and then grant specific
privileges on the objects to the non-DBA role.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_authentication_control"></a>Authentication Control</h3>
</div>
</div>
</div>
<p>Authentication is the mechanism that determines if a user can
access the database at all. Once authentication is performed, the
authorization mechanism is used to determine which database objects the
particular user can access. The default authentication mechanism is
password authentication. Each user is created with a password, which is
stored in the database and checked each time a new database connection
is created.</p>
<a name="N1426E" class="indexterm"></a>
<p>
<span class="bold"><strong>Password Complexity
Check</strong></span>
</p>
<p>HyperSQL allows you to define a function that checks the quality
of the passwords defined in the database. The passwords are stored in
the database. Each time a user connects, the user's name and password
are checked against the stored list of users and passwords. The
connection attempt is rejected if there is no match.</p>
<a name="N14279" class="indexterm"></a>
<p>
<span class="bold"><strong>External
Authentication</strong></span>
</p>
<p>You can use an external authentication mechanism instead of the
internal authentication mechanism. HyperSQL allows you to define a
function that checks the combination of database unique name, user name,
and password for each connection attempt. The function can use external
resources to authenticate the user. For example, a directory server may
be used. The password may be ignored if the external resource can verify
the user's credential without it.</p>
<p>You can override external authentication for a user with the ALTER
USER statement. See the <a class="link" href="accesscontrol-chapt.html" title="Chapter 6. Access Control">Access Control</a> chapter</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a name="mtc_compatibility_other"></a>Compatibility with Other RDBMS</h2>
</div>
</div>
</div>
<p>HyperSQL is used more than any other database engine for application
testing and development targeted at other databases. Over the years, this
usage resulted in developers finding and reporting many obscure bugs in
HyperSQL, which have all been fixed in the latest version. Also, HyperSQL
2.0 has been written to the SQL Standard and avoids the traps caused by
superficial imitation of existing RDBMS.</p>
<p>HyperSQL has many property settings that relax conformance to the
Standard in order to allow compatibility with other RDBMS, without
breaking the core integrity of the database. These properties are modified
with SET DATABASE SQL statements described in the SQL Conformance Settings
section of this chapter</p>
<p>The SQL Standard has existed since 1989 and has been expanded over
the years in several revisions. Also, the X-Open specification has defined
a number of SQL functions which are implemented by most RDBMS.</p>
<p>Each RDBMS supports additional functions that are not covered by the
standard. Some RDBMS use non-standard syntax for some operations.
Fortunately, most popular RDBMS products have introduced better
compatibility with the Standard in their recent versions, but there are
still some portability issues. HyperSQL overcomes the potability issues
using these strategies</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>An extensive set of functions cover the SQL Standard, X-Open,
and most of the useful functions that other RDBMS may support.</p>
</li>
<li class="listitem">
<p>Database properties, which can be specified on the URL or as SQL
statements, relax conformance to the Standard in order to allow
non-standard comparisons and assignments allowed by other
RDBMS.</p>
</li>
<li class="listitem">
<p>Specific SQL syntax compatibility modes allow syntax and type
names that are supported by some popular RDBMS.</p>
</li>
<li class="listitem">
<p>User-defined types and functions, including aggregate functions,
allow any type or function that is supported by some RDBMS to be
defined and used.</p>
</li>
</ul>
</div>
<p>In the future, the supported compatibility modes with other RDBMS
will be expanded further.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_compatibility_postgres"></a>PostgreSQL Compatibility</h3>
</div>
</div>
</div>
<p>PostgreSQL is fairly compatible with the Standard, but uses some
non-standard features.</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>Use <code class="literal"><set database sql syntax PGS
statement></code> to enable the PostgreSQL's non-standard
features. References to SERIAL, BIGSERIAL and TEXT data types, as
well as sequence functions, are translated into HSQLDB
equivalents.</p>
</li>
<li class="listitem">
<p>Use MVCC if your application is multi-user</p>
</li>
<li class="listitem">
<p>PostgreSQL functions are generally supported</p>
</li>
<li class="listitem">
<p>For identity columns, PostgreSQL uses a non-standard linkage
with an external identity sequence. In most cases, this can be
converted to <code class="literal">GENERATED BY DEFAULT AS IDENTITY</code>. In
those cases where the identity sequence needs to be shared by
multiple tables, you can use a new HyperSQL 2.2 feature
<code class="literal">GENERATED BY DEFAULT AS SEQUENCE <sequence
name></code>, which is the equivalent of the PostgreSQL
implementation.</p>
</li>
<li class="listitem">
<p>In CREATE TABLE statements, the SERIAL and BIGSERIAL types are
translated into INTEGER or BIGINT, with <code class="literal">GENERATED BY
DEFAULT AS IDENTITY</code>. Usage of DEFAULT NEXTVAL(<sequence
name>) is supported so long as the <code class="literal"><sequence
name></code> refers to an existing sequence. This usage is
translated into <code class="literal">GENERATED BY DEFAULT AS SEQUENCE
<sequence name></code>.</p>
</li>
<li class="listitem">
<p>In SELECT and other statements, the
<code class="literal">NEXTVAL(<sequence name>)</code> and
<code class="literal">LASTVAL()</code> functions are supported and translated
into HyperSQL's <code class="literal">NEXT VALUE FOR <sequence
name></code> and <code class="literal">IDENTITY()</code>
expressions.</p>
</li>
<li class="listitem">
<p>PostgreSQL uses a non-standard expression, <code class="literal">SELECT 'A
Test String'</code> to return a single row table. The standard
form is <code class="literal">VALUES('A Test String')</code>. In PGS syntax
mode, this type of SELECT is supported.</p>
</li>
<li class="listitem">
<p>HyperSQL supports SQL Standard ARRAY types. PostgreSQL also
supports this, but not entirely according to the Standard.</p>
</li>
<li class="listitem">
<p>SQL routines are portable, but some syntax elements are
different and require changes.</p>
</li>
<li class="listitem">
<p>You may need to use <code class="literal">SET DATABASE SQL TDC { DELETE |
UPDATE } FALSE</code> statements, as PostgreSQL does not enforce
the subtle rules of the Standard for foreign key cascading deletes
and updates.</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_compatibility_mysql"></a>MySQL Compatibility</h3>
</div>
</div>
</div>
<p>MySQL had many incompatibilities with the Standard. The latest
versions have introduced much greater compatibly, but some of these
features have to be turned on via properties. You should therefore check
the current Standard compatibility settings of your MySQL database and
use the available HyperSQL properties to achieve closer results. If you
avoid the few anti-Standard features of MySQL you can port your
databases to HyperSQL.</p>
<p>HyperSQL does not have the following non-standard limitations of
MySQL.</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>Win HyperSQL, an UPDATE statement can update UNIQUE and
PRIMARY KEY columns of a table without causing an exception due to
temporary violation of constraints. These constraints are checked at
the end of execution, therefore there is no need for an ORDER BY
clause in an UPDATE statement.</p>
</li>
<li class="listitem">
<p>MySQL foreign key constraints are not enforced by the default
MyISAM engine. Be aware of the possibility of data being rejected by
HyperSQL due to these constraints.</p>
</li>
<li class="listitem">
<p>With HyperSQL INSERT or UPDATE statements either succeed or
fail due to constraint violation. MySQL has the non-standard IGNORE
overrides to ignore violations, which is not accepted by
HyperSQL.</p>
</li>
<li class="listitem">
<p>Unlike MySQL, HyperSQL allows you to modify a table with an
INSERT, UPDATE or DELETE statement which selects from the same table
in a subquery.</p>
</li>
</ul>
</div>
<p>Follow the guidelines below for converting MySQL databases and
applications.</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>Use <code class="literal"><set database sql syntax MYS
statement></code> to enable support for AUTO_INCREMENT and
TEXT data types. These type definitions are translated into HSQLDB
equivalents.</p>
</li>
<li class="listitem">
<p>Use MVCC with <code class="literal"><set database transaction control
statement></code> if your application is multi-user.</p>
</li>
<li class="listitem">
<p>Avoid storing invalid values, for example invalid dates such
as '0000-00-00' or '2001-00-00' which are rejected by
HyperSQL.</p>
</li>
<li class="listitem">
<p>Avoid the MySQL feature that trims spaces at the end of CHAR
values.</p>
</li>
<li class="listitem">
<p>In MySQL, a database is the same as a schema. In HyperSQL
several schemas can exist in the same database and accessed
transparently. In addition a HyperSQL server supports multiple
separate databases.</p>
</li>
<li class="listitem">
<p>In MySQL, older, non-standard, forms of database object name
case-sensitivity make is difficult to port applications. Use the
latest form which encloses case-sensitive names in double
quotes.</p>
</li>
<li class="listitem">
<p>MySQL functions are generally supported, including
GROUP_CONCAT.</p>
</li>
<li class="listitem">
<p>For fine control over type conversion, check the settings for
<code class="literal"><set database sql convert truncate
statement></code>
</p>
</li>
<li class="listitem">
<p>If you use concatenation of possibly NULL values in your
select statements, you may need to change the setting with the
<code class="literal"><set database sql concat nulls
statement></code>
</p>
</li>
<li class="listitem">
<p>MySQL supports most SQL Standard types (except INTERVAL
types), as well as non-standard types, which are also supported by
HyperSQL. Supported types include SMALLINT, INT, BIGINT, DOUBLE,
FLOAT, DECIMAL, NUMERIC, VARCHAR, CHAR, BINARY, VARBINARY, BLOB,
DATE, TIMESTAMP (all Standard SQL) and TINYINT, DATETIME (non
Standard).</p>
</li>
<li class="listitem">
<p>MySQL uses a non-standard expression, <code class="literal">SELECT 'A Test
String'</code> to return a single row table. The standard form is
<code class="literal">VALUES('A Test String')</code>. In MYS syntax mode, this
type of SELECT is supported.</p>
</li>
<li class="listitem">
<p>SQL user-defined function and procedure syntax is very similar
to SQL Standard syntax. A few changes may still be required.</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_compatibility_firebird"></a>Firebird Compatibility</h3>
</div>
</div>
</div>
<p>Firebird generally follows the SQL Standard. Applications can be
ported to HyperSQL without difficulty.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_compatibility_derby"></a>Apache Derby Compatibility</h3>
</div>
</div>
</div>
<p>Apache Derby supports a smaller subset of the SQL Standard
compared to HyperSQL. Applications can be ported to HyperSQL without
difficulty.</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>Use MVCC with <code class="literal"><set database transaction control
statement></code> if your application is multi-user.</p>
</li>
<li class="listitem">
<p>HyperSQL supports Java language functions and stored
procedures with the standard syntax, which is similar to the way
Derby supports these features.</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_compatibility_oracle"></a>Oracle Compatibility</h3>
</div>
</div>
</div>
<p>Recent versions of Oracle support Standard SQL syntax for outer
joins and many other operations. In addition, HyperSQL features a
setting to support Oracle syntax and semantics for the most widely used
non-standard features.</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>Use <code class="literal"><set database sql syntax ORA
statement></code> to enable support for some non-standard
syntax of Oracle.</p>
</li>
<li class="listitem">
<p>Use MVCC with <code class="literal"><set database transaction control
statement></code> if your application is multi-user.</p>
</li>
<li class="listitem">
<p>Fine control over MVCC deadlock avoidance is provided by the
<code class="literal"><set database transaction rollback on conflict
statement></code> and the corresponding
<code class="literal">hsqldb.tx_conflict_rollback</code> connection
property.</p>
</li>
<li class="listitem">
<p>If your application relies on Oracle behaviour for nulls in
multi-column UNIQUE constraints, use <code class="literal"><set database sql
unique nulls statement></code> to change the default.</p>
</li>
<li class="listitem">
<p>If you use the non-standard concatenation of possibly NULL
values in your select statements, you may need to change the setting
for <code class="literal"><set database sql concat nulls
statement></code>.</p>
</li>
<li class="listitem">
<p>Many Oracle functions are supported, including no-arg
functions such as SYSDATE and SYSTIMESTAMP and more complex ones
such as TO_DATE and TO_CHAR.</p>
</li>
<li class="listitem">
<p>Non-standard data type definitions such as NUMBER, VARCHAR2,
NVARCHAR2, BINARY_DOUBLE, BINARY_FLOAT, LONG, RAW are translated
into the closest HyperSQL / SQL Standard equivalent in ORA
mode.</p>
</li>
<li class="listitem">
<p>The DATE type is interpreted as TIMESTAMP(0) in ORA syntax
mode.</p>
</li>
<li class="listitem">
<p>The DUAL table and the expressions, ROWNUM, CURRVAL, NEXTVAL
are supported in ORA syntax mode.</p>
</li>
<li class="listitem">
<p>HyperSQL natively supports operations involving datetime and
interval values. These features are based on the SQL
Standard.</p>
</li>
<li class="listitem">
<p>Many subtle automatic type conversions, syntax refinements and
other common features are supported.</p>
</li>
<li class="listitem">
<p>SQL routines are generally portable, but some changes may be
required.</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_compatibility_db2"></a>DB2 Compatibility</h3>
</div>
</div>
</div>
<p>DB2 is highly compatible with the SQL Standard (except its lack of
support for the INFORMATION_SCHEMA). Applications can be ported to
HyperSQL without difficulty.</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>Use <code class="literal"><set database sql syntax DB2
statement></code> to enable support for some non-standard
syntax of DB2.</p>
</li>
<li class="listitem">
<p>Use MVCC with <code class="literal"><set database transaction control
statement></code> if your application is multi-user.</p>
</li>
<li class="listitem">
<p>HyperSQL supports almost the entire syntax of DB2 together
with many of the functions. Even local temporary tables using the
SESSION pseudo schema are supported.</p>
</li>
<li class="listitem">
<p>The DB2 binary type definition FOR BIT DATA, as well as empty
definition of column default values are supported in DB2 syntax
mode.</p>
</li>
<li class="listitem">
<p>Many DB2 functions are supported.</p>
</li>
<li class="listitem">
<p>The DUAL table and the expressions, ROWNUM, CURRVAL, NEXTVAL
are supported in DB2 syntax mode.</p>
</li>
<li class="listitem">
<p>SQL routines are highly portable with minimal change.</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_compatibility_mssql"></a>MS SQLServer and Sybase Compatibility</h3>
</div>
</div>
</div>
<p>SQLServer has some incompatibilities with the Standard syntax. The
most significant is the use of square brackets instead of double quotes
for case-sensitive column names.</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>Use <code class="literal"><set database sql syntax MSS
statement></code> to enable support for the
<code class="literal">CONVERT(<type definition>, <expression)</code>
function with switched order of arguments</p>
</li>
<li class="listitem">
<p>Use MVCC with <code class="literal"><set database transaction control
statement></code> if your application is multi-user.</p>
</li>
<li class="listitem">
<p>If you use the non-standard concatenation of possibly NULL
values in your select statements, you may need to change the setting
for <set database sql concat nulls statement>.</p>
</li>
<li class="listitem">
<p>HyperSQL supports + for string concatenation. It also supports
many functions supported by these dialects.</p>
</li>
<li class="listitem">
<p>SQLServer uses a non-standard expression, <code class="literal">SELECT 'A
Test String'</code> to return a single row table. The standard
form is <code class="literal">VALUES('A Test String')</code>. In MSS syntax
mode, this type of SELECT is supported.</p>
</li>
<li class="listitem">
<p>SQL routines need quite a lot of changes.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both">
<a name="mtc_statements"></a>Statements</h2>
</div>
</div>
</div>
<p>System level statements are listed in this section. Statements that
begin with SET DATABASE or SET FILES are for properties that have an
effect on the normal operation of HyperSQL. The effects of these
statements are also discussed in different chapters.</p>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_system_operations"></a>System Operations</h3>
</div>
</div>
</div>
<p>These statements perform a system level action.</p>
<a name="N143E6" class="indexterm"></a>
<p>
<span class="bold"><strong>SHUTDOWN</strong></span>
</p>
<p>
<span class="emphasis"><em>shutdown statement</em></span>
</p>
<p>
<code class="literal"><shutdown statement> ::= SHUTDOWN [IMMEDIATELY |
COMPACT | SCRIPT]</code>
</p>
<p>Shutdown the database. If the optional qualifier is not used, a
normal SHUTDOWN is performed. A normal SHUTDOWN ensures all data is
saved correctly and the database opens without delay on next
use.</p>
<div class="variablelist">
<table border="0" class="variablelist">
<colgroup>
<col valign="top" align="left">
<col>
</colgroup>
<tbody>
<tr>
<td>
<p>
<span class="term">SHUTDOWN</span>
</p>
</td><td>
<p>Normal shutdown saves all the database files, then deletes
the .log file (and the .backup file in the default mode). This
does the same thing as CHECKPOINT, but closes the database when it
completes. The database opens without delay on next used.</p>
</td>
</tr>
<tr>
<td>
<p>
<span class="term">SHUTDOWN IMMEDIATELY</span>
</p>
</td><td>
<p>Saves the *.log file and closes the database files. This is
the quickest form of shutdown. This command should not be used as
the routine method of closing the database, because when the
database is accessed next time, it may take a long time to
start.</p>
</td>
</tr>
<tr>
<td>
<p>
<span class="term">SHUTDOWN COMPACT</span>
</p>
</td><td>
<p>This is similar to normal SHUTDOWN, but reduces the *.data
file to its minimum size. It can take much longer than normal
SHUTDOWN. This shouldn't be used as routine.</p>
</td>
</tr>
<tr>
<td>
<p>
<span class="term">SHUTDOWN SCRIPT</span>
</p>
</td><td>
<p>This is similar to SHUTDOWN COMPACT, but it does not rewrite
the <code class="literal">*.data</code> and text table files. After SHUTDOWN
SCRIPT, only the <code class="literal">*.script</code> and
<code class="literal">*.properties</code> files remain. At the next startup,
these files are processed and the <code class="literal">*.data</code> file
is created if there are cached tables. This command in effect
performs part of the job of SHUTDOWN COMPACT, leaving the other
part to be performed automatically at the next startup.</p>
<p>This command produces a full script of the database which
can be edited for special purposes prior to the next
startup.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>Only a user with the DBA role can execute this
statement.</p>
<a name="N14420" class="indexterm"></a>
<p>
<span class="bold"><strong>BACKUP DATABASE</strong></span>
</p>
<p>
<span class="emphasis"><em>backup database statement</em></span>
</p>
<p>
<code class="literal"><backup database statement> ::= BACKUP DATABASE
TO <file path> [SCRIPT] {[NOT] COMPRESSED} {[NOT]
BLOCKING}</code>
</p>
<p>Backup the database to specified <code class="literal"><file
path></code> for archiving purposes.</p>
<p>The <code class="literal"><file path></code> can be in two forms.
If the <code class="literal"><file path></code> ends with a forward slash,
it specifies a directory. In this case, an automatic name for the
archive is generated that includes the date, time and the base name of
the database. The database is backed up to this archive file in the
specified directory. The archive is in <code class="literal">.tar.gz</code> or
<code class="literal">.tar</code> format depending on whether it is compressed or
not.</p>
<p>If the <code class="literal"><file path></code> does not end with a
forward slash, it specifies a user-defined file name for the backup
archive. The file extension must be either <code class="literal">.tar.gz</code> or
<code class="literal">.tar</code> and this must match the compression
option.</p>
<p>The default set of options is COMPRESSED BLOCKING.</p>
<p>If SCRIPT is specified, the backup will contain a
<code class="literal">*.script</code> file, which contain all the data and
settings of the database. Otherwise, it consists of the current snapshot
of all database files.</p>
<p>If NOT COMPRESSED is specified, the backup is a tar file,
without compression. Otherwise, it is in gzip format.</p>
<p>The qualifier, BLOCKING, means all database operations are
suspended during backup. During backup, a CHECKPOINT command is silently
executed. This mode is always used when SCRIPT is specified.</p>
<p>Hot backup is performed if NOT BLOCKING is specified. In this
mode, the database can be used during backup. This mode should only be
used with very large databases. A hot backup set is less compact and
takes longer to restore and use than a normal backup set produced with
the BLOCKING option. You can perform a CHECKPOINT just before a hot
backup in order to reduce the size of the backup set.</p>
<p>The HyperSQL jar also contains a program that creates an
archive of an offline database. It also contains a program to expand an
archive into database files. These programs are documented in this
chapter under Backing up Database Catalogs.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<a name="N1445E" class="indexterm"></a>
<p>
<span class="bold"><strong>CHECKPOINT</strong></span>
</p>
<p>
<span class="emphasis"><em>checkpoint statement</em></span>
</p>
<p>
<code class="literal"><checkpoint statement> ::= CHECKPOINT
[DEFRAG]</code>
</p>
<p>Closes the database files, rewrites the script file, deletes
the log file and opens the database. If <code class="literal">DEFRAG</code> is
specified, also shrinks the <code class="literal">*.data</code> file to its
minimum size.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<a name="N14479" class="indexterm"></a>
<p>
<span class="bold"><strong>SCRIPT</strong></span>
</p>
<p>
<span class="emphasis"><em>script statement</em></span>
</p>
<p>
<code class="literal"><script statement> ::= SCRIPT [<file
name>]</code>
</p>
<p>Returns a script containing SQL statements that define the
database, its users, and its schema objects. If <code class="literal"><file
name></code> is not specified, the statements are returned in a
ResultSet, with each row containing an SQL statement. No data statements
are included in this form. The optional file name is a single-quoted
string. If <code class="literal"><file name></code> is specified, then the
script is written to the named file. In this case, all the data in all
tables of the database is included in the script as INSERT
statements.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_database_settings"></a>Database Settings</h3>
</div>
</div>
</div>
<p>These statements change the database settings.</p>
<a name="N14498" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE
COLLATION</strong></span>
</p>
<p>
<span class="emphasis"><em>set database collation statement</em></span>
</p>
<p>
<code class="literal"><set database collation statement> ::= SET
DATABASE COLLATION <collation name> [ NO PAD | PAD SPACE
]</code>
</p>
<p>Each database can have its own default collation. Sets the
collation from the set of collations supported by HyperSQL. Once this
command has been issued, the database can be opened in any JVM and will
retain its collation.</p>
<p>All collations pad the shorter string with spaces when two
strings are compared. If NO PAD is specified, comparison is performed
without padding. The default system collation is named SQL_TEXT. To use
the default without padding use SET DATABASE COLLATION SQL_TEXT NO
PAD.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<a name="N144AD" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE DEFAULT RESULT MEMORY
ROWS</strong></span>
</p>
<p>
<span class="emphasis"><em>set database default result memory rows
statement</em></span><code class="literal"> </code>
</p>
<p>
<code class="literal"><set database default result memory rows> ::=
SET DATABASE DEFAULT RESULT MEMORY ROWS <unsigned integer
literal></code>
</p>
<p>Sets the maximum number of rows of each result set and internal
temporary table that is held in memory. Temporary tables includes views,
schema-based and session-based TEMPORARY tables, transient tables for
subqueries, and INFORMATION_SCHEMA tables.</p>
<p>This setting applies to all sessions. Individual sessions can
change the value with the <code class="literal">SET SESSION RESULT MEMORY
ROWS</code> statement. The default is 0, meaning all result sets are
held in memory.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.result_max_memory_rows</code>.</p>
<a name="N144CC" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE DEFAULT TABLE
TYPE</strong></span>
</p>
<p>
<span class="emphasis"><em>set database default table type
statement</em></span><code class="literal"> </code>
</p>
<p>
<code class="literal"><set database default table type> ::= SET
DATABASE DEFAULT TABLE TYPE { CACHED | MEMORY }</code>
</p>
<p>Sets the type of table created when the next CREATE TABLE
statement is executed. The default is MEMORY.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.default_table_type</code>.</p>
<a name="N144E6" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE EVENT LOG
LEVEL</strong></span>
</p>
<p>
<span class="emphasis"><em>set database event log level
statement</em></span>
</p>
<p>
<code class="literal"><set database event log level> ::= SET DATABASE
EVENT LOG [ SQL ] LEVEL { 0 | 1 | 2 | 3 }</code>
</p>
<p>When the SQL option is not used, this statement sets the amount
of information logged in the internal, database-specific event log.
Level 0 means no log. Level 1 means only important (error) events. Level
2 means more events, including both important and less important
(normal) events. Level 3 includes even more details. For readonly and
<em class="glossterm">mem:</em> databases, if the level is set above 0, the
log messages are directed to stderr.</p>
<p>The events are logged in a file with the extension
<code class="literal">.app.log</code> alongside the main database files.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.applog</code>.</p>
<p>When the SQL option is used, this statement logs the SQL
statements as they are executed. Each log line contains the timestamp
and the session number, followed by the SQL statement and JDBC arguments
if any.</p>
<p>Levels 1 and 2 are supported. Level 1 only logs commits and
rollbacks, while Level 2 logs all statements.</p>
<p>The logged lines are stored in a file with the extension
<code class="literal">.sql.log</code> alongside the main database files.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.sqllog</code>.</p>
<a name="N14514" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE GC</strong></span>
</p>
<p>
<span class="emphasis"><em>set database gc statement</em></span>
</p>
<p>
<code class="literal"><set database gc statement> ::= SET DATABASE GC
<unsigned integer literal></code>
</p>
<p>An optional property which forces calls to <code class="literal">System.gc()
</code>after the specified number of row operations. The default
value for this property is 0, which means no System.gc() calls. Usual
values for this property range from 10000 depending on the system and
the memory allocation. This property may be useful in some in-process
deployments, especially with older JVM implementations.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<a name="N1452A" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE UNIQUE
NAME</strong></span>
</p>
<p>
<span class="emphasis"><em>set database unique name</em></span><code class="literal">
</code>
</p>
<p>
<code class="literal"><set database unique name statement> ::= SET
DATABASE UNIQUE NAME <identifier></code>
</p>
<p>Each HyperSQL catalog (database) has an engine-generated
internal name. This name is a 16 character long string, beginning with
HSQLDB and based on the time of creation of the database. The name is
used for the log events that are sent to external logging frameworks.
The new name must be exactly 16 characters long with no
spaces.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<a name="N1453F" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE TRANSACTION
CONTROL</strong></span>
</p>
<p>
<span class="emphasis"><em>set database transaction control
statement</em></span>
</p>
<p>
<code class="literal"><set database transaction control statement> ::=
SET DATABASE TRANSACTION CONTROL { LOCKS | MVLOCKS | MVCC
}</code>
</p>
<p>Set the concurrency control system for the database. It can be
issued only when all sessions have been committed or rolled back. This
command and its modes is discussed in the <a class="link" href="sessions-chapt.html" title="Chapter 3. Sessions and Transactions">Sessions and Transactions</a> chapter.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.tx</code>.</p>
<a name="N1455B" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE TRANSACTION ROLLBACK ON
CONFLICT</strong></span>
</p>
<p>
<span class="emphasis"><em>set database transaction rollback on conflict
statement</em></span>
</p>
<p>
<code class="literal"><set database transaction rollback on conflict
statement> ::= SET DATABASE TRANSACTION ROLLBACK ON CONFLICT { TRUE |
FALSE }</code>
</p>
<p>When a transaction deadlock or conflict is about to happen, the
current transaction is rolled back and an exception is raised. When this
property is set false, the transaction is not rolled back. Only the
latest statement that would cause the conflict is undone and an
exception is raised. The property should not be changed unless the
application can quickly perform an alternative statement and complete
the transaction. It is provided for compatibility with other database
engines which do not roll back the transaction upon deadlock. This
command is also discussed in the <a class="link" href="sessions-chapt.html" title="Chapter 3. Sessions and Transactions">Sessions and Transactions</a> chapter.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.tx_conflict_rollback</code>.</p>
<a name="N14577" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE DEFAULT ISOLATION
LEVEL</strong></span>
</p>
<p>
<span class="emphasis"><em>set database default isolation level
statement</em></span><code class="literal"> </code>
</p>
<p>
<code class="literal"><set database default isolation level> ::= SET
DATABASE DEFAULT ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE
}</code>
</p>
<p>Sets the transaction isolation level for new sessions. The
default is READ COMMITTED. Each session can also set its isolation
level.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.tx_level</code>.</p>
<a name="N14591" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE TEXT TABLE
DEFAULTS</strong></span>
</p>
<p>
<span class="emphasis"><em>set database text table defaults
statement</em></span>
</p>
<p>
<code class="literal"><set database text table defaults statement> ::=
SET DATABASE TEXT TABLE DEFAULTS <character
literal></code>
</p>
<p>An optional property to override default text table settings.
The string literal has the same format as the string used for setting
the data source of a text table, but without the file name. See the
<a class="link" href="texttables-chapt.html" title="Chapter 5. Text Tables">Text Tables</a>
chapter.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_sql_settings"></a>SQL Conformance Settings</h3>
</div>
</div>
</div>
<p>These statements modify the level of conformance to the SQL
Standard in different areas. The settings that specify SQL SYNTAX are
for compatibility with other database engines and are FALSE by default.
For all the rest of the settings, TRUE means better conformance to the
Standard (unless the Standard defines the behaviour as implementation
dependent). The default value of a few of these settings is FALSE, due
to widespread non-conforming statements that are already in use in user
applications or statements generated by object relational tools. So long
as it is practical, it is best to set the non-conforming defaults to
TRUE in order to improve the quality of the database
application.</p>
<a name="N145AE" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL
SIZE</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql size statement</em></span>
</p>
<p>
<code class="literal"><set database sql size statement> ::= SET
DATABASE SQL SIZE { TRUE | FALSE }</code>
</p>
<p>Enable or disable enforcement of column sizes for CHAR and
VARCHAR columns. The default is TRUE, meaning table definition must
contain <code class="literal">VARCHAR(n)</code> instead of
<code class="literal">VARCHAR</code>.</p>
<p>SQL Standard requires enforcement.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.enforce_size</code>.</p>
<a name="N145CE" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL
NAMES</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql names statement</em></span>
</p>
<p>
<code class="literal"><set database sql names statement> ::= SET
DATABASE SQL NAMES { TRUE | FALSE }</code>
</p>
<p>Enable or disable full enforcement of the rule that prevents
SQL keywords being used for database object names such as columns and
tables. The default is <code class="literal">FALSE</code>, meaning
disabled.</p>
<p>SQL Standard requires enforcement. <span class="emphasis"><em>It is better to
enable this check, in order to improve the quality and correctness of
SQL statements.</em></span>
</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.enforce_names</code>.</p>
<a name="N145ED" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL REGULAR
NAMES</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql regular names
statement</em></span>
</p>
<p>
<code class="literal"><set database sql regular names statement> ::=
SET DATABASE SQL REGULAR NAMES { TRUE | FALSE }</code>
</p>
<p>Enable or disable use of the underscore character at the
beginning, or the dollar character anywhere in database object names
such as columns and tables. The default is <code class="literal">TRUE</code>,
meaning disabled.</p>
<p>SQL Standard does not allow the underscore character at the
start of names, and does not allow the dollar character anywhere in a
name. This setting can be changed for compatibility with existing
database or for porting databases which include names that do not
conform to the Standard.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.regular_names</code>.</p>
<a name="N1460A" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL
REFERENCES</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql references
statement</em></span>
</p>
<p>
<code class="literal"><set database sql references statement> ::= SET
DATABASE SQL REFERENCES { TRUE | FALSE }</code>
</p>
<p>This command can enable or disable full enforcement of the rule
that prevents ambiguous column references in SQL statements (usually
SELECT statements). A column reference is ambiguous when it is not
qualified by a table name or table alias and can refer to more than one
column in a JOIN list.</p>
<p>The property is <code class="literal">FALSE</code> by default.</p>
<p>SQL Standard requires enforcement. <span class="emphasis"><em>It is better to
enable this check, in order to improve the quality and correctness of
SQL statements.</em></span> When false, the first matching table is used
to resolve the column reference.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.enforce_refs</code>.</p>
<a name="N1462C" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL
TYPES</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql types statement</em></span>
</p>
<p>
<code class="literal"><set database sql types statement> ::= SET
DATABASE SQL TYPES { TRUE | FALSE }</code>
</p>
<p>This command can enable or disable full enforcement of the
rules that prevents illegal type conversions and parameters or nulls
without type in SQL statements (usually SELECT statements). For example
an INTEGER column or a DATE column cannot be compared to a character
string or searched with a LIKE expression when the property is
<code class="literal">TRUE</code>.</p>
<p>The property is <code class="literal">FALSE</code> by default.</p>
<p>SQL Standard requires enforcement. <span class="emphasis"><em>It is better to
enable this check, in order to improve the quality and correctness of
SQL statements.</em></span>
</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.enforce_type</code>.</p>
<a name="N14650" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL TDC
DELETE</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql tdc delete
statement</em></span>
</p>
<p>
<code class="literal"><set database sql tdc delete statement> ::= SET
DATABASE SQL TDC DELETE { TRUE | FALSE }</code>
</p>
<p>This command can enable or disable full enforcement of the SQL
Standard rules that prevents triggered data change exceptions caused by
ON DELETE CASCADE clauses of foreign key constraint.</p>
<p>When there are multiple constraints, a row may be updated by
one constraint and deleted by another constraint in the same operation.
This is not allowed by default. Changing this to false allows such
violations of the Standard to pass without an exception.</p>
<p>The property is <code class="literal">TRUE</code> by default.</p>
<p>SQL Standard requires enforcement, therefore this property
shouldn't be changed unless an application written for a non-conforming
RDBMS needs it.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.enforce_tdc_delete</code>.</p>
<a name="N14671" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL TDC
UPDATE</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql tdc update
statement</em></span>
</p>
<p>
<code class="literal"><set database sql tdc update statement> ::= SET
DATABASE SQL TDC UPDATE { TRUE | FALSE }</code>
</p>
<p>This command can enable or disable full enforcement of the SQL
Standard rules that prevents triggered data change exceptions caused by
multiple ON UPDATE or ON DELETE SET clauses of foreign key constraint.
When there are multiple constraints, a field in a row may be updated by
two constraints to different values in the same operation. This is not
allowed by default. Changing this to <code class="literal">FALSE</code> allows
such violations of the Standard to pass without an exception.</p>
<p>The property is <code class="literal">TRUE</code> by default.</p>
<p>SQL Standard requires enforcement, therefore this property
shouldn't be changed unless an application written for a non-conforming
RDBMS needs it.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.enforce_tdc_update</code>.</p>
<a name="N14693" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL TRANSLATE TTI
TYPES</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql translate tti types
statement</em></span>
</p>
<p>
<code class="literal"><set database sql translate tti types statement>
::= SET DATABASE SQL TRANSLATE TTI TYPES { TRUE | FALSE
}</code>
</p>
<p>The JDBC Specification up to version 4.1 does not support some
SQL Standard built-in types, therefore these types must be translated to
a supported type when accessed through JDBC ResultSet and
PreparedStatement methods.</p>
<p>If the property is true, the TIME / TIMESTAMP WITH TIME ZONE
types and INTERVAL types are represented in JDBC methods of
<code class="classname">ResultSetMetaData</code> and
<code class="classname">DatabaseMetaData</code> as JDBC datetime types without
time zone and the VARCHAR type respectively. The original type names are
preserved.</p>
<p>The property is <code class="literal">TRUE</code> by default. If set to
<code class="literal">FALSE</code>, the type codes for WITH TIME ZONE types will
be SQL type codes as opposed to JDBC type codes.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">jdbc.translate_tti_types</code>.</p>
<a name="N146BB" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL CONCAT
NULLS</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql concat nulls
statement</em></span>
</p>
<p>
<code class="literal"><set database sql concat nulls statement> ::=
SET DATABASE SQL CONCAT NULLS { TRUE | FALSE }</code>
</p>
<p>When the property is <code class="literal">TRUE</code>, concatenation of
a null value with a not-null value results in a null value. When the
property is <code class="literal">FALSE</code> this type of concatenation result
in the not-null value.</p>
<p>Setting this property <code class="literal">FALSE</code> results in
concatenation behaviour similar to Oracle or MS SQL Server.</p>
<p>SQL Standard requires a NULL result..</p>
<p>The property is <code class="literal">TRUE</code> by default.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.concat_nulls</code>.</p>
<a name="N146E5" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL UNIQUE
NULLS</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql unique nulls
statement</em></span>
</p>
<p>
<code class="literal"><set database sql unique nulls statement> ::=
SET DATABASE SQL UNIQUE NULLS { TRUE | FALSE }</code>
</p>
<p>When the property is <code class="literal">TRUE</code>, with multi-column
UNIQUE constraints, it is possible to insert multiple rows for which one
or more of the values for the constraint columns is NULL. When the
property is <code class="literal">FALSE</code>, if there is any not-null value in
the columns, then the set of values is compared to the existing rows and
if there is a match, an exception is thrown. The setting
<code class="literal">FALSE</code>, makes the behaviour more restrictive. For
example, inserting (1, null) twice is possible by default, but not
possible when the property is <code class="literal">FALSE</code>.</p>
<p>Setting this property <code class="literal">FALSE</code> results in
UNIQUE constraint behaviour similar to Oracle.</p>
<p>SQL Standard requires the default (TRUE) behaviour.</p>
<p>The property is <code class="literal">TRUE</code> by default.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.unique_nulls</code>.</p>
<a name="N14715" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL CONVERT
TRUNCATE</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql unique convert
truncate</em></span>
</p>
<p>
<code class="literal"><set database sql convert truncate statement>
::= SET DATABASE SQL CONVERT TRUNCATE { TRUE | FALSE
}</code>
</p>
<p>When the property is <code class="literal">TRUE</code>, conversion from a
floating point value (a DOUBLE value) to an integral type always
truncates the fractional part. When the property is
<code class="literal">FALSE</code>, rounding takes place instead of truncation.
For example, assigning the value 123456E-2 to an integer column will
result in 1234 by default, but 1235 when the property is
<code class="literal">FALSE</code>.</p>
<p>Standard SQL considers this behaviour implementation
dependent.</p>
<p>The property is <code class="literal">TRUE</code> by default.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.convert_trunc</code>.</p>
<a name="N1473D" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL AVG
SCALE</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql avg scale</em></span>
</p>
<p>
<code class="literal"><set database sql avg scale> ::= SET DATABASE
SQL AVG SCALE <numeric value></code>
</p>
<p>By default, the result of division and the AVG and MEDIAN
aggregate functions has the same type as the aggregated type of the
values. This includes the scale. The scale specified with this property
is used if it is larger than the scale of the operation. For example,
the average of 5 and 10 is 7 by default, but 7.50 if the scale is
specified as 2. The result of 7/3 is 2 by default but 2.33 if the scale
is specified as 2.</p>
<p>Standard SQL considers this behaviour implementation dependent.
Some databases use a default scale larger than zero.</p>
<p>The property is <code class="literal">0</code> by default.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.avg_scale</code>.</p>
<a name="N1475C" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL DOUBLE
NAN</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql double nan</em></span>
</p>
<p>
<code class="literal"><set database sql double nan> ::= SET DATABASE
SQL DOUBLE NAN { TRUE | FALSE }</code>
</p>
<p>When the property is <code class="literal">TRUE</code>, division of a
floating point value (a DOUBLE value) by zero raises an exception. When
the property is <code class="literal">FALSE</code>, a Java
<code class="literal">Double.NaN</code>, <code class="literal">POSITIVE_INFINITY</code> or
<code class="literal">NEGATIVE_INFINITY</code> value is returned.</p>
<p>Standard SQL requires an exception to be raised.</p>
<p>The property is <code class="literal">TRUE</code> by default.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.double_nan</code>.</p>
<a name="N1478A" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL NULLS
FIRST</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql nulls first</em></span>
</p>
<p>
<code class="literal"><set database sql nulls first> ::= SET DATABASE
SQL NULLS FIRST { TRUE | FALSE }</code>
</p>
<p>When the property is <code class="literal">TRUE</code>, nulls appear
before values in result sets with ORDER BY. When set FALSE, nulls appear
after the values. Some databases, including PostgreSQL, Oracle and MS
SQL Server, return nulls after the values.</p>
<p>The property is <code class="literal">TRUE</code> by default.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.nulls_first</code>.</p>
<a name="N147AA" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL SYNTAX
DB2</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql syntax DB2</em></span>
</p>
<p>
<code class="literal"><set database sql syntax DB2 statement> ::= SET
DATABASE SQL SYNTAX DB2 { TRUE | FALSE }</code>
</p>
<p>This property, when set TRUE, enables support for some elements
of DB2 syntax. Single-row SELECT statements (<code class="literal">SELECT
<expression list></code> without the FROM clause) are supported
and treated as the SQL Standard equivalent, <code class="literal">VALUES
<expression list></code>. The DUAL table is supported, as well
as the ROWNUM pseudo-column. BINARY type definitions such as VARCHAR(L)
FOR BIT DATA are supported. Empty DEFAULT clauses in column definitions
are supported.</p>
<p>The property is <code class="literal">FALSE</code> by default.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.syntax_db2</code>.</p>
<a name="N147CD" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL SYNTAX
MSS</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql syntax MSS</em></span>
</p>
<p>
<code class="literal"><set database sql syntax MSS statement> ::= SET
DATABASE SQL SYNTAX MSS { TRUE | FALSE }</code>
</p>
<p>This property, when set TRUE, enables support for some elements
of SQLServer syntax. Single-row SELECT statements (<code class="literal">SELECT
<expression list></code> without the FROM clause) are supported
and treated as the SQL Standard equivalent, <code class="literal">VALUES
<expression list></code>. The parameters of CONVERT() function
are switched in this mode.</p>
<p>The property is <code class="literal">FALSE</code> by default.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.syntax_mss</code>.</p>
<a name="N147F0" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL SYNTAX
MYS</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql syntax MYS</em></span>
</p>
<p>
<code class="literal"><set database sql syntax MYS statement> ::= SET
DATABASE SQL SYNTAX MYS { TRUE | FALSE }</code>
</p>
<p>This property, when set TRUE, enables support for some elements
of MySQL syntax. The TEXT data type is translated to
LONGVARCHAR.</p>
<p>In CREATE TABLE statements, [NOT NULL | NULL] can be used
immediately after the column type name and before the DEFAULT clause.
AUTO_INCREMENT is translated to the GENERATED BY DEFAULT AS IDENTITY
clause.</p>
<p>Single-row SELECT statements (<code class="literal">SELECT <expression
list></code> without the FROM clause) are supported and treated as
the SQL Standard equivalent, <code class="literal">VALUES <expression
list></code>.</p>
<p>The property is <code class="literal">FALSE</code> by default.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.syntax_mys</code>.</p>
<a name="N14817" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL SYNTAX
ORA</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql syntax ORA</em></span>
</p>
<p>
<code class="literal"><set database sql syntax ORA statement> ::= SET
DATABASE SQL SYNTAX ORA { TRUE | FALSE }</code>
</p>
<p>This property, when set TRUE, enables support for some elements
of Oracle syntax. The DUAL table is supported, together with ROWNUM,
NEXTVAL and CURRVAL syntax and semantics.</p>
<p>The non-standard types are translated to supported standard
types. BINARY_DOUBLE and BINARY_FLOAT are translated to DOUBLE. LONG RAW
and RAW are translated to VARBINARY with long or medium length limits.
LONG and VARCHAR2 are translated to VARCHAR with long or medium length
limits. NUMBER is translated to DECIMAL. Some extra type conversions and
no-arg functions are also allowed in this mode.</p>
<p>The property is <code class="literal">FALSE</code> by default.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.syntax_ora</code>.</p>
<a name="N14836" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE SQL SYNTAX
PGS</strong></span>
</p>
<p>
<span class="emphasis"><em>set database sql syntax PGS</em></span>
</p>
<p>
<code class="literal"><set database sql syntax PGS statement> ::= SET
DATABASE SQL SYNTAX PGS { TRUE | FALSE }</code>
</p>
<p>This property, when set TRUE, enables support for some elements
of PosgtreSQL syntax. The TEXT data type is translated to LONGVARCHAR,
while the SERIAL data types is translated to BIGINT together with
GENERATED BY DEFAULT AS IDENTITY.</p>
<p>Single-row SELECT statements (<code class="literal">SELECT <expression
list></code> without the FROM clause) are supported and treated as
the SQL Standard equivalent, <code class="literal">VALUES <expression
list></code>.</p>
<p>The functions <code class="literal">NEXTVAL(<sequence name
string>)</code>, <code class="literal">CURRVAL(<sequence name
string>)</code> and <code class="literal">LASTVAL()</code> are supported in
this compatibility mode.</p>
<p>The property is <code class="literal">FALSE</code> by default.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">sql.syntax_pgs</code>.</p>
<a name="N14866" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE REFERENTIAL
INTEGRITY</strong></span>
</p>
<p>
<span class="emphasis"><em>set database referential integrity
statement</em></span>
</p>
<p>
<code class="literal"><set database referential integrity statement>
::= SET DATABASE REFERENTIAL INTEGRITY { TRUE | FALSE
}</code>
</p>
<p>This command enables or disables the enforcement of referential
integrity constraints (foreign key constraints), check constraints apart
from NOT NULL and execution of triggers. By default, all constraints are
checked.</p>
<p>The only legitimate use of this statement is before importing
large amounts of external data into tables that have existing FOREIGN
KEY constraints. After import, the statement must be used again to
enable constraint enforcement.</p>
<p>If you are not sure the data conforms to the constraints, run
queries to verify all rows conform to the FOREIGN KEY constraints and
take appropriate actions for the rows that do not conform.</p>
<p>A query example to return the rows in a foreign key table that
have no parent is given below:</p>
<div class="example">
<a name="N1487D"></a>
<p class="title">
<b>Example 11.5. Finding foreign key rows with no parents after a bulk
import</b>
</p>
<div class="example-contents">
<pre class="screen"> SELECT * FROM foreign_key_table LEFT OUTER JOIN primary_key_table
ON foreign_key_table.fk_col = primary_key_table.pk_col WHERE primary_key_table.pk_col IS NULL</pre>
</div>
</div>
<br class="example-break">
<p>Only a user with the DBA role can execute this
statement.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_cache_persistence"></a>Cache, Persistence and Files Settings</h3>
</div>
</div>
</div>
<p>These statements control the memory and other settings for
database persistence.</p>
<a name="N1488A" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES BACKUP INCREMENT
</strong></span>
</p>
<p>
<span class="emphasis"><em>set files backup increment
statement</em></span>
</p>
<p>
<code class="literal"><set files backup increment statement> ::= SET
FILES BACKUP INCREMENT { TRUE | FALSE }</code>
</p>
<p>Older versions of HSQLDB perform a backup of the .data file
before its contents are modified and the whole .data file is saved in a
compressed form when a CHECKPOINT or SHUTDOWN is performed. This takes a
long time when the size of the database exceeds 100 MB or so (on an
average 2010 computer, you can expect a backup speed of 20MB per second
or more).</p>
<p>The alternative is backup in increments, just before some part
of the .data file is modified. In this mode, no backup is performed at
CHECKPOINT or SHUTDOWN. This mode is preferred for large databases which
are opened and closed frequently.</p>
<p>The default mode is <code class="literal">TRUE</code>. If the old method
of backup is preferred, the mode can be set
<code class="literal">FALSE</code>.</p>
<p>Warning: The old, non-incremental setting, FALSE, shouldn't be
used at all when the data file is larger than 4GB. If it is used, the
data file is not fully backed up and can result in corruption. The zip
compression method is used in this mode and it is limited to 4GB
size.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.inc_backup</code>.</p>
<a name="N148AE" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES CACHE ROWS</strong></span>
</p>
<p>
<span class="emphasis"><em>set files cache rows statement</em></span><code class="literal">
</code>
</p>
<p>
<code class="literal"><set files cache rows statement> ::= SET FILES
CACHE ROWS <unsigned integer literal></code>
</p>
<p>Sets the maximum number of rows (of CACHED tables) held in the
memory cache. The default is 50000 rows.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.cache_rows</code>.</p>
<a name="N148C8" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES CACHE SIZE</strong></span>
</p>
<p>
<span class="emphasis"><em>set files cache size statement</em></span><code class="literal">
</code>
</p>
<p>
<code class="literal"><set files cache size statement> ::= SET FILES
CACHE SIZE <unsigned integer literal></code>
</p>
<p>Sets maximum amount of data (of CACHED tables) in kilobytes
held in the memory cache. The default is 10000 kilobytes. Note the
amount of memory used is larger than this amount, which does not account
for Java object size overheads.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.cache_size</code>.</p>
<a name="N148E2" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES DEFRAG</strong></span>
</p>
<p>
<span class="emphasis"><em>set files defrag statement</em></span>
</p>
<p>
<code class="literal"><set files defrag statement> ::= SET FILES
DEFRAG <unsigned integer literal></code>
</p>
<p>Sets the threshold for performing a DEFRAG during a checkpoint.
The <code class="literal"><unsigned integer literal></code> is the
percentage of abandoned space in the <code class="literal">*.data</code> file.
When a CHECKPOINT is performed either as a result of the
<code class="literal">.log</code> file reaching the limit set by <code class="literal">SET
FILES LOG SIZE m</code>, or by the user issuing a CHECKPOINT command,
the amount of space abandoned since the database was opened is checked
and if it is larger than specified percentage, a CHECKPOINT DEFRAG is
performed instead of a CHECKPOINT.</p>
<p>The default is 0, which indicates no DEFRAG. Useful values are
between 10 to 50.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.defrag_limit</code>.</p>
<a name="N14908" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES LOG</strong></span>
</p>
<p>
<span class="emphasis"><em>set files log statement</em></span>
</p>
<p>
<code class="literal"><set files log statement> ::= SET FILES LOG {
TRUE | FALSE }</code>
</p>
<p>Sets logging of database operations on or off. Turning logging
off is for special usage, such as temporary cache usage. The default is
TRUE.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.log_data</code>.</p>
<a name="N14920" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES LOG SIZE</strong></span>
</p>
<p>
<span class="emphasis"><em>set files log size statement</em></span>
</p>
<p>
<code class="literal"><set files log size statement> ::= SET FILES LOG
SIZE <unsigned integer literal></code>
</p>
<p>Sets the maximum size in MB of the <code class="literal">*.log</code>
file to the specified value. The default maximum size is 50 MB. If the
value is zero, no limit is used for the size of the file. When the size
of the file reaches this value, a CHECKPOINT is performed and the the
<code class="literal">*.log</code> file is cleared to size 0.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.log_size</code>.</p>
<a name="N1493E" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES NIO</strong></span>
</p>
<p>
<span class="emphasis"><em>set files nio</em></span>
</p>
<p>
<code class="literal"><set files nio statement> ::= SET FILES NIO {
TRUE | FALSE }</code>
</p>
<p>Sets the access method of the .data file. The default is TRUE
and uses the Java nio classes to access the file via memory-mapped
buffers.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.nio_data_file</code>.</p>
<a name="N14956" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES NIO SIZE</strong></span>
</p>
<p>
<span class="emphasis"><em>set files nio size</em></span>
</p>
<p>
<code class="literal"><set files nio size statement> ::= SET FILES NIO
SIZE <unsigned integer literal></code>
</p>
<p>Sets The maximum size of .data file in megabytes that can use
the nio access method. When the file gets larger than this limit,
non-nio access methods are used. Values 64, 128, 256, 512, 1024 and
larger multiples of 512 can be used. The default is 256MB.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.nio_max_size</code>.</p>
<a name="N1496E" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES WRITE
DELAY</strong></span>
</p>
<p>
<span class="emphasis"><em>set files write delay statement</em></span>
</p>
<p>
<code class="literal"><set files write delay statement> ::= SET FILES
WRITE DELAY {{ TRUE | FALSE } | <seconds value> | <milliseconds
value> MILLIS}</code>
</p>
<p>Set the WRITE DELAY property of the database. The WRITE DELAY
controls the frequency of file sync for the log file. When WRITE_DELAY
is set to FALSE or 0, the sync takes place immediately at each COMMIT.
WRITE DELAY TRUE performs the sync once every 0.5 seconds (which is the
default). A numeric value can be specified instead.</p>
<p>The purpose of this command is to control the amount of data loss
in case of a total system crash. A delay of 1 second means at most the
data written to disk during the last second before the crash is lost.
All data written prior to this has been synced and should be
recoverable.</p>
<p>A write delay of 0 impacts performance in high load situations, as
the engine has to wait for the file system to catch up.</p>
<p>To avoid this, you can set write delay down to 10
milliseconds.</p>
<p>Each time the SET FILES WRITE DELAY statement is executed with any
value, a sync is immediately performed.</p>
<p>Only a user with the DBA role can execute this statement.</p>
<p>This is equivalent to the connection properties
<code class="literal">hsqldb.write_delay</code> and
<code class="literal">hsqldb.write_delay_millis</code>.</p>
<a name="N14991" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES SCALE</strong></span>
</p>
<p>
<span class="emphasis"><em>set files scale</em></span>
</p>
<p>
<code class="literal"><set files scale statement> ::= SET FILES SCALE
<scale value></code>
</p>
<p>Changes the scale factor for the .data file. The default scale
is 8 and allows 16GB of data storage capacity. The scale can be
increased in order to increase the maximum data storage capacity. The
scale values 8, 16, 32, 64, 128, 256, 512, 1024 are allowed. Scale value
1024 allows a maximum capacity of 2 TB.</p>
<p>This command can be used only when there is no data in CACHED
tables. This is equivalent to the connection property
<code class="literal">hsqldb.cache_file_scale</code>.</p>
<p>The scale factor indicates the size of the unit of storage of
data in bytes. For example, with a scale factor of 128, a row containing
a small amount of data will use 128 bytes. Larger rows may use multiple
units of 128 bytes.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.cache_file_scale</code>.</p>
<a name="N149B0" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES LOB SCALE</strong></span>
</p>
<p>
<span class="emphasis"><em>set files lob scale</em></span>
</p>
<p>
<code class="literal"><set files lob scale statement> ::= SET FILES
LOB SCALE <scale value></code>
</p>
<p>Changes the scale factor for the .lobs file. The scale is
interpreted in kilobytes. The default scale is 32 and allows 64TB of lob
data storage capacity. The scale can be reduced in order to improve
storage efficiency. If the lobs are a lot smaller than 32 kilobytes,
reducing the scale will reduce wasted space. The scale values 1, 2, 4,
8, 16, 32 are allowed. For example if the average size of lobs is 4
kilobytes, the default scale of 32 will result in 28KB wasted space for
each lob. Reducing the lob scale to 2 will result in average 1KB wasted
space for each lob.</p>
<p>This command can be used only when there is no lob in the
database.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>This is equivalent to the connection property
<code class="literal">hsqldb.lob_file_scale</code>.</p>
<a name="N149CA" class="indexterm"></a>
<p>
<span class="bold"><strong>SET FILES SCRIPT
FORMAT</strong></span>
</p>
<p>
<span class="emphasis"><em>set files script format</em></span>
</p>
<p>
<code class="literal"><set files script format statement> ::= SET
FILES SCRIPT FORMAT { TEXT | COMPRESSED }</code>
</p>
<p>Changes the compression setting for database scripts. The
default is text. Using COMPRESSED results in the storage of the .script
file in gzip compressed form. Using this command causes a
CHECKPOINT.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<a name="N149DD" class="indexterm"></a>
<p>
<span class="bold"><strong>SET TABLE TYPE</strong></span>
</p>
<p>
<span class="emphasis"><em>set table type</em></span>
</p>
<p>
<code class="literal"><set table type statement> ::= SET TABLE
<table name> TYPE { MEMORY | CACHED }</code>
</p>
<p>Changes the storage type of an existing table between CACHED
and MEMORY types.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title">
<a name="mtc_authntication_settings"></a>Authentication Settings</h3>
</div>
</div>
</div>
<p>Two settings are available for authentication control.</p>
<p>When the default password authentication is used, the passwords
can be checked for complexity according to administrative rules</p>
<a name="N149F8" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE PASSWORD CHECK
FUNCTION</strong></span>
</p>
<p>
<span class="emphasis"><em>set database password check
function</em></span>
</p>
<p>
<code class="literal"><set database password check function statement>
::= SET DATABASE PASSWORD CHECK FUNCTION { <routine body> | NONE
}</code>
</p>
<p>The routine body is the body of a function that has a VARCHAR
parameter and returns a BOOLEAN. This function checks the
<code class="literal">PASSWORD</code> submitted as parameter and returns TRUE if
it conforms to complexity checks, or FALSE, if it does not.</p>
<p>The <code class="literal"><routine body></code> can be an SQL block
or an external Java function reference. This is covered in the <a class="link" href="sqlroutines-chapt.html" title="Chapter 8. SQL-Invoked Routines">SQL-Invoked Routines</a>
chapter</p>
<p>To disable this mechanism, the token <code class="literal">NONE</code>
can be specified instead of the <code class="literal"><routine
body></code>.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<p>In the examples below, an SQL function and a Java function are
used.</p>
<pre class="programlisting">SET DATABASE PASSWORD CHECK FUNCTION
BEGIN ATOMIC
IF CHAR_LENGTH(PASSWORD) > 6 THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END
SET DATABASE PASSWORD CHECK FUNCTION EXTERNAL NAME 'CLASSPATH:org.anorg.access.AccessClass.accessMethod'
// the Java method is defined like this
public static boolean accessMethod(String param) {
return param != null && param.length > 6;
}
</pre>
<p>It is possible to replace the default password authentication
completely with a function that uses external authentication servers,
such as LDAP. This function is called each time a user connects to the
database.</p>
<a name="N14A25" class="indexterm"></a>
<p>
<span class="bold"><strong>SET DATABASE AUTHENTICATION
FUNCTION</strong></span>
</p>
<p>
<span class="emphasis"><em>set database authentication
function</em></span>
</p>
<p>
<code class="literal"><set database authentication function statement>
::= SET DATABASE AUTHENTICATION FUNCTION { <external body
reference> | NONE }</code>
</p>
<p>The routine body is an external Java function reference. This
function has three String parameters. The first parameter is the unique
name of the database, the second parameter the user name, and the third
parameter the password.</p>
<p>External authentication can be used in two different patterns.
In the first pattern, user names must be stored in the database. In the
second pattern, user names shouldn't be stored in the database and any
names that are stored in the database are ignored.</p>
<p>In both patterns, the username and password are checked by the
authentication function. If the function throws a runtime exception then
authentication fails.</p>
<p>In the first pattern, the function always returns null if
authentication is successful.</p>
<p>In the second pattern, the function returns a list of role
names that have been granted to the user. These roles must match the
ROLE objects that have been defined in the database.</p>
<p>The Java function should return an instance of
org.hsqldb.jdbc.JDBCArrayBasic constructed with a String[] argument that
contains the role names.</p>
<p>Only a user with the DBA role can execute this
statement.</p>
<pre class="programlisting">SET DATABASE AUTHENTICATION FUNCTION EXTERNAL NAME 'CLASSPATH:org.anorg.access.AccessClass.accessExernalMethod'
// the Java method is defined like this
public static java.sql.Array accessExternalMethod(String database, String user, String password) {
if (externalCheck(database, user, password) {
return null;
}
throw new RuntimeException("failed to authenticate");
}
</pre>
</div>
</div>
</div>
<HR xmlns:xi="http://www.w3.org/2001/XInclude">
<P xmlns:xi="http://www.w3.org/2001/XInclude" class="svnrev">$Revision: 4864 $</P>
<div class="navfooter">
<hr>
<table summary="Navigation footer" width="100%">
<tr>
<td align="left" width="40%"><a accesskey="p" href="builtinfunctions-chapt.html"><img src="../images/db/prev.png" alt="Prev"></a> </td><td align="center" width="20%"> </td><td align="right" width="40%"> <a accesskey="n" href="dbproperties-chapt.html"><img src="../images/db/next.png" alt="Next"></a></td>
</tr>
<tr>
<td valign="top" align="left" width="40%">Chapter 10. Built In Functions </td><td align="center" width="20%"><a accesskey="h" href="index.html"><img src="../images/db/home.png" alt="Home"></a></td><td valign="top" align="right" width="40%"> Chapter 12. Properties</td>
</tr>
</table>
</div>
</body>
</html>
|