Package org.netbeans.api.db.explorer

Examples of org.netbeans.api.db.explorer.DatabaseConnection


    * not be successfully opened
    */
   public static Connection getDBConnection(String dbName, String projName) {
      ConnectionManager cMgr = ConnectionManager.getDefault();
      DatabaseConnection[] dbconnList = cMgr.getConnections();
      DatabaseConnection dbconn = null;
      // find a connection for given database & project, if one exists
      System.out.println("DBConnList size: " + dbconnList.length);
      if (dbconnList.length > 0) {
         for (DatabaseConnection con : dbconnList) {
            String name = con.getDisplayName().toLowerCase();
System.out.println(con.getDisplayName());
            if (name.contains(dbName) && name.contains(projName)) {
               dbconn = con;
            }
         }
      }
     
      if (dbconn == null) {
         // TODO: create a connection here if none found
         return null;
      } else {
         System.out.println("Got db connection: " + dbconn.getName());
//         System.out.println("  Driver: " + dbconn.getJDBCDriver().getName());
//         System.out.println("     URL: " + dbconn.getDatabaseURL());
//         System.out.println("    user: " + dbconn.getUser());
//         System.out.println("  schema: " + dbconn.getSchema());
      }
      Connection connection = dbconn.getJDBCConnection();
      if (connection == null) {
         cMgr.showConnectionDialog(dbconn);
      }
      return connection;
   }
View Full Code Here


    @Override
    protected void performAction(Node[] nodes) {

        Node cNode = nodes[0].getParentNode().getParentNode().getParentNode();
        DatabaseConnection dbconn = cNode.getLookup().lookup(DatabaseConnection.class);
        if (dbconn.getJDBCConnection() == null) {
            ConnectionManager.getDefault().showConnectionDialog(dbconn);
        }

        Thread t = new Thread(new MapperRunnable(dbconn));
        t.start();
View Full Code Here

TOP

Related Classes of org.netbeans.api.db.explorer.DatabaseConnection

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.