JDBC/NetRexx

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

JDBC/NetRexx

Jason Anderson-2
Hello all,
I hope this email find the list. (Did the address change ??)
I have a project in JBuilder2 Client/Server edition that reads a database
via JDBC. I would like to convert my code to netRexx (simply because netRexx
ROCKS!!!). But I am having and @#&! of a time trying to set the dbswing
Database object, and I predict I will have even more trouble trying to set
up the JDBC/32bit ODBC connect as well. Can anyone help me as I would really
like to invoke the power of netRexx with database connectivity. Below is the
source JBuilder code I wish to convert:
I appreciate any help with this or any other practical solution.
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////
// HERE is the web02.java file   //
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////
package web02;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import borland.jbcl.layout.*;
import borland.jbcl.control.*;
import borland.sql.dataset.*;
import java.util.*;
import borland.dbswing.*;
import com.sun.java.swing.event.*;
//import com.sun.java.swing.UIManager;
public class web02 extends Applet {
  ResourceBundle sqlRes = ResourceBundle.getBundle("web02.SqlRes");
  XYLayout xYLayout1 = new XYLayout();
  boolean isStandalone = false;
  Database database1 = new Database();
  QueryDataSet queryDataSet1 = new QueryDataSet();
  JdbNavToolBar navbar = new JdbNavToolBar();
  JdbTable jdbTable1 = new JdbTable();
//Get a parameter value
  public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
      (getParameter(key) != null ? getParameter(key) : def);
  }
  //Construct the applet
  public web02() {
  }
//Initialize the applet
  public void init() {
    try {
    jbInit();
    }
    catch (Exception e) {
    e.printStackTrace();
    }
  }
  //static
  //  try
  //    //UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.metal.MetalLookAndFeel());
  //    //UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.motif.MotifLookAndFeel());
  //    UIManager.setLookAndFeel(new
com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
  //  }
  //  catch (Exception e) {}
  //}
//Component initialization
  private void jbInit() throws Exception {
    xYLayout1.setWidth(742);
    xYLayout1.setHeight(684);
    database1.setConnection(new
borland.sql.dataset.ConnectionDescriptor("jdbc:odbc:iiuser", "", "", false,
"sun.jdbc.odbc.JdbcOdbcDriver"));
    queryDataSet1.setQuery(new
borland.sql.dataset.QueryDescriptor(database1, sqlRes.getString("Webacces"),
null, true, Load.ALL));
    navbar.setDataSet(queryDataSet1);
    navbar.setNextFocusableComponent(jdbTable1);
    navbar.addAncestorListener(new
com.sun.java.swing.event.AncestorListener() {
      public void ancestorAdded(AncestorEvent e) {
        navbar_ancestorAdded(e);
      }
      public void ancestorRemoved(AncestorEvent e) {
      }
      public void ancestorMoved(AncestorEvent e) {
      }
    });
    navbar.addMouseListener(new java.awt.event.MouseAdapter() {
      public void mousePressed(MouseEvent e) {
      }
      public void mouseClicked(MouseEvent e) {
      }
    });
    jdbTable1.setDataSet(queryDataSet1);
    this.setLayout(xYLayout1);
    this.add(navbar, new XYConstraints(5, 376, -1, -1));
    this.add(jdbTable1, new XYConstraints(2, 53, 579, 306));
  }
//Get Applet information
  public String getAppletInfo() {
    return "Applet Information";
  }
//Get parameter info
  public String[][] getParameterInfo() {
    return null;
  }
  void navbar_ancestorAdded(AncestorEvent e) {
  }
}
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////
// HERE is the SqlRes.java file   //
////////////////////////////////////////////////////////////////////////////
//////////////////////////////////
package web02;
import java.util.*;
public class SqlRes extends java.util.ListResourceBundle {
  static final Object[][] contents = {
{ "Webacces", "SELECT * FROM Webacces" }};
  public Object[][] getContents() {
    return contents;
  }
}


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>