Starts the database server in a separate process. @param port server port @param args command-line arguments @throws BaseXException database exception
(final int port, final String... args)
| 287 | * @throws BaseXException database exception |
| 288 | */ |
| 289 | public static void start(final int port, final String... args) throws BaseXException { |
| 290 | // start server and check if it caused an error message |
| 291 | final String error = Util.error(Util.start(BaseXServer.class, args), 2000); |
| 292 | if(error != null) throw new BaseXException(error.trim()); |
| 293 | |
| 294 | // try to connect to the new server instance |
| 295 | if(!ping(S_LOCALHOST, port)) throw new BaseXException(CONNECTION_ERROR_X, port); |
| 296 | } |
| 297 | |
| 298 | /** |
| 299 | * Checks if a server is running. |