Package org.apache.derby.drda

Examples of org.apache.derby.drda.NetworkServerControl


    public void execute() throws BuildException {
        try {
            System.out.println("Stopping Derby");
            System.setProperty("derby.drda.portNumber", port);
            System.setProperty("derby.drda.host", "localhost");
            NetworkServerControl server = new NetworkServerControl();
            server.shutdown();
            try {Thread.sleep(2000);} catch (Exception ignored) {}

        } catch (Exception e) {
            throw new BuildException(e.getMessage());
        }
View Full Code Here


        try {
            System.out.println("Stopping Derby");
            System.setProperty("derby.system.home", database);
            System.setProperty("derby.drda.portNumber", port);
            System.setProperty("derby.drda.host", "localhost");
            NetworkServerControl server = new NetworkServerControl();
            server.start(new PrintWriter(System.out));
            try {Thread.sleep(2000);} catch (Exception ignored) {}
        } catch (Exception e) {
            throw new BuildException("Unable to load Derby driver");
        }
       
View Full Code Here

    }

    public void start() throws ServiceException {
        if (disabled) return;
        try {
            serverControl = new NetworkServerControl(host, port);
            //serverControl.setMaxThreads(threads);

            serverControl.start(new Log4jPrintWriter("Derby", Priority.INFO));
        } catch (Exception e) {
            throw new ServiceException(e);
View Full Code Here

    }

    public void start() throws ServiceException {
        if (disabled) return;
        try {
            serverControl = new NetworkServerControl(host, port);
            //serverControl.setMaxThreads(threads);

            serverControl.start(new LoggingPrintWriter("Derby"));
        } catch (Exception e) {
            throw new ServiceException(e);
View Full Code Here

        return new InetSocketAddress(getHost(), getPort());
    }

    public void doStart() throws Exception {
        InetAddress address = InetAddress.getByName(host);
        network = new NetworkServerControl(address, port);
        network.start(null); // todo work out how to add this to our log stream
        log.debug("Started on host " + host + ':' + port);
    }
View Full Code Here

     
      /************************************************************
       *  Test sysinfo by calling NetworkServerControl.getSysinfo()
       ************************************************************/
      System.out.println("Testing Sysinfo (method)");
      NetworkServerControl derbyServer =
        new NetworkServerControl( InetAddress.getByName("localhost"),
                    NetworkServerControl.DEFAULT_PORTNUMBER);
      System.out.println(derbyServer.getSysinfo());
      System.out.println("End test (method)");
     
      /************************************************************
       *  Test sysinfo w/ foreign (non-English) locale
       ************************************************************/
 
View Full Code Here

            BufferedOutputStream bos = new BufferedOutputStream(System.out, 1024);
      /************************************************************
       *  Test comments in front of select's doesn't cause problems
       ************************************************************/
      //create wombat database
      NetworkServerControl server = new NetworkServerControl();
      System.out.println("Testing various ij connections and comments in front of selects");
     
      // first, we have to massage the .sql file to replace localhost, if
      // there is a system property set.
           
View Full Code Here

            e.printStackTrace();
        }

   

    NetworkServerControl serverControl = null;
    boolean started = false;


    try {

      serverControl = new
        NetworkServerControl(InetAddress.getByName("0.0.0.0"),
                   NETWORKSERVER_PORT);

      serverControl.start(new PrintWriter(System.out,true));
     
      for (int i = 1; i < 50; i++)
      {
        Thread.sleep(1000);
        if (isServerStarted(serverControl))
        {
          started = true;
          break;
        }
      }
       
    } catch (Exception e)
    {
      e.printStackTrace();
    }
    if(started)
      dbg("NetworkServer started");
    else
    {
      System.out.println("FAIL Network Server did not start");
      return;
    }
    String hostName = TestUtil.getHostName();
    String jdbcUrlPrefix = TestUtil.getJdbcUrlPrefix(hostName, NETWORKSERVER_PORT);

        String url = jdbcUrlPrefix + databaseFileName;

        Connection connection = null;
      
        try {
      // Just connect, do something and close the connection
            connection = DriverManager.getConnection(url, "user", "password");
      Statement stmt = connection.createStatement();
      ResultSet rs = stmt.executeQuery("Select  tablename   from  sys.systables");
     
      while (rs.next())
      {
        rs.getString(1);
      }
      rs.close();
            dbg("Connected to database " + databaseFileName);
      // Leave the connection open before shutdown to make
      // sure the thread closes down.
      // connection.close();
     
      System.out.println("getting ready to shutdown");
      serverControl.shutdown();
      Thread.sleep(5000);

        } catch (Exception e) {
      System.out.print("FAIL: Unexpected exception" + e.getMessage());
            e.printStackTrace();
View Full Code Here

  private static boolean start = false;
  public static void main (String args[]) throws Exception
  {
    try
    {
      NetworkServerControl server = new NetworkServerControl();
      Properties p = server.getCurrentProperties();
      p.list(System.out);
      ij.getPropertyArg(args);

      // create a connection in a different thread
      startConnection();
      // wait for connection
      joinwait();
      //server.setLogWriter(System.out);
      // set tracing on for the waiting connection
      server.trace(3, true);
      //test NetworkServerControl.logConnections
      server.logConnections(true);
      // get properties
      System.out.println("Properties with tracing on");
      p = server.getCurrentProperties();
      p.list(System.out);
      // set tracing on for all connections
      server.trace(true);
      //test NetworkServerControl.setTraceDirectory
      server.setTraceDirectory(DERBY_SYSTEM_HOME);
      // get properties
      System.out.println("Properties with tracing on");
      p = server.getCurrentProperties();
      p.list(System.out);
      joinsignal();
    }
    catch (Exception e)
    {
View Full Code Here

      ij.getPropertyArg(args);
      Connection conn1 = ij.startJBMS();

          bos = new BufferedOutputStream(System.out, 1024);

      server = new NetworkServerControl();
      /************************************************************
       *  Test max threads
       ************************************************************/
      System.out.println("Testing maxthreads");
      //test maxthreads 0
View Full Code Here

TOP

Related Classes of org.apache.derby.drda.NetworkServerControl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.