Derby Server and Administration Guide Version 10.15
Total Page:16
File Type:pdf, Size:1020Kb
Derby Server and Administration Guide Version 10.15 Derby Document build: February 4, 2020, 5:03:39 PM (PST) Version 10.15 Derby Server and Administration Guide Contents Copyright................................................................................................................................4 License................................................................................................................................... 5 About this guide....................................................................................................................9 Purpose of this guide................................................................................................9 Audience..................................................................................................................... 9 How this guide is organized.....................................................................................9 Part One: Derby Server Guide...........................................................................................11 Derby in a multi-user environment........................................................................ 11 Derby in a server framework...............................................................................11 About this guide and the Network Server documentation...................................14 Using the Network Server with preexisting Derby applications..........................14 The Network Server and Java Virtual Machines (JVMs).....................................14 Installing required jar files and adding them to the classpath/modulepath.......... 14 Starting the Network Server................................................................................15 Shutting down the Network Server..................................................................... 18 Obtaining system information..............................................................................19 Accessing the Network Server by using the network client driver.......................21 Accessing the Network Server by using a DataSource object............................ 27 XA and the Network Server................................................................................ 29 Using the Derby tools with the Network Server.................................................. 29 Differences between running Derby in embedded mode and using the Network Server.................................................................................................................. 30 Setting port numbers...........................................................................................31 Managing the Derby Network Server.....................................................................31 Overview of Derby Network Server management...............................................31 Setting Network Server properties...................................................................... 32 Verifying startup...................................................................................................38 Using Java Management Extensions (JMX) technology......................................38 Introduction to the Derby MBeans...................................................................... 39 Enabling and disabling JMX................................................................................40 Using JConsole to access the Derby MBeans....................................................47 Using custom Java code to access the Derby MBeans......................................48 Troubleshooting JMX connection issues.............................................................50 Managing the Derby Network Server remotely by using the servlet interface.................................................................................................................... 51 Start-up page.......................................................................................................52 Running page...................................................................................................... 52 Trace session page.............................................................................................52 Trace directory page........................................................................................... 53 Set Network Server parameters..........................................................................53 Derby Network Server advanced topics................................................................53 Configuring the Network Server to handle connections...................................... 53 Controlling logging by using the log file.............................................................. 54 Controlling tracing by using the trace facility...................................................... 54 Derby Network Server sample programs.............................................................. 55 The NsSample sample program......................................................................... 55 Network Server sample programs for embedded and client connections........... 57 Part Two: Derby Administration Guide.............................................................................61 Maintaining database integrity............................................................................... 61 Checking database consistency............................................................................ 61 i Version 10.15 Derby Server and Administration Guide The SYSCS_CHECK_TABLE function................................................................61 Sample SYSCS_CHECK_TABLE error messages............................................. 62 Sample SYSCS_CHECK_TABLE queries.......................................................... 62 Backing up and restoring databases.....................................................................63 Backing up a database....................................................................................... 63 Restoring a database from a backup copy......................................................... 67 Creating a database from a backup copy...........................................................68 Roll-forward recovery.......................................................................................... 68 Importing and exporting data.................................................................................70 Methods for running the import and export procedures...................................... 71 Bulk import and export requirements and considerations................................... 71 Bulk import and export of large objects.............................................................. 72 File format for input and output...........................................................................73 Importing data using the built-in procedures.......................................................74 Exporting data using the built-in procedures.......................................................78 Examples of bulk import and export................................................................... 80 Running import and export procedures from JDBC............................................ 81 How the import and export procedures process NULL values............................82 CODESET values for import and export procedures.......................................... 82 Replicating databases............................................................................................. 82 Starting and running replication.......................................................................... 83 Stopping replication............................................................................................. 84 Forcing a failover.................................................................................................84 Replication and security...................................................................................... 85 Replication failure handling................................................................................. 85 Logging on a separate device................................................................................87 Using the logDevice=logDirectoryPath attribute..................................................87 Example of creating a log in a non-default location............................................87 Example of moving a log manually.....................................................................87 Issues for logging in a non-default location........................................................ 88 Obtaining locking information................................................................................88 Monitoring deadlocks...........................................................................................88 Reclaiming unused space.......................................................................................89 Trademarks.......................................................................................................................... 91 ii Derby Server and Administration Guide Apache Software FoundationDerby Server and Administration GuideApache Derby 3 Derby Server and Administration Guide Copyright Copyright 2004-2020 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Related information License 4 Derby Server and