home *** CD-ROM | disk | FTP | other *** search
/ Enter 1999 September / ENTER9_2.bin / prog_8 / jbuilder3 / TRIAL / INTRCLNT / DATA.Z / ServerManagerExample.java < prev    next >
Encoding:
Java Source  |  1999-01-18  |  1.4 KB  |  40 lines

  1. // Copyright InterBase Software Corporation, 1998.
  2. // Written by com.inprise.interbase.interclient.r&d.PaulOstler :-)
  3. //
  4. // An example of using a JDBC 2 Standard Extension DataSource
  5. // for obtaining ServerManager connections.
  6.  
  7. public final class ServerManagerExample
  8. {
  9.   static public void main (String args[])
  10.   {
  11.     // Create an InterClient data source bean manually;
  12.     // beans are normally manipulated by a GUI tool.
  13.     // Bean properties are always set using the setXXX signature.
  14.     interbase.interclient.DataSource dataSource = new interbase.interclient.DataSource ();
  15.     
  16.     // Set the standard properties
  17.     dataSource.setServerName ("perdy");
  18.     dataSource.setDataSourceName ("Employee");
  19.     dataSource.setDescription ("An example database of employees");
  20.     dataSource.setPortNumber (3060);
  21.     dataSource.setNetworkProtocol ("jdbc:interbase:");
  22.     dataSource.setRoleName (null);
  23.     
  24.     // Set the non-standard properties
  25.     dataSource.setServerManagerHost ("perdy");
  26.  
  27.     // Obtain a ServerManager for the DataSource's Server Manager Host
  28.     try {
  29.       dataSource.setLoginTimeout (10);
  30.       interbase.interclient.ServerManager service = dataSource.getServerManager ("sysdba", "masterkey");
  31.       System.out.println ("got server manager");
  32.       service.close ();
  33.     }
  34.     catch (java.sql.SQLException e) {
  35.       System.out.println ("sql exception: " + e.getMessage ());
  36.     }
  37.   }
  38. }
  39.               
  40.