Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Accessing a Table from another database

Accessing a Table from another database

Accessing a Table from another database

Is there a way to access a table from another database while working in another database?  If so could anyone help me to do it?  Its urgent!!!

RE: Accessing a Table from another database

I did it like this, hope it works 4 U..

Drop a agcData on your form, and set load data to (from business object)..
Businnes object name : your path to the bso
(I have this com.exemple.dsos.dsoEditTableData)
Now jou kan loop trhu the agcData to see what you get.
I hope this is what you r looking 4..

Code for de DataBussinesObject...
package com.examples.dsos;

import java.awt.*;
import java.util.*;
import java.math.*;
import com.sssw.srv.api.*;
import com.sssw.srv.mail.*;
import com.sssw.srv.busobj.*;
import java.io.*;
import com.sssw.rt.gui.*;
import com.sssw.rt.util.*;
import com.sssw.rt.event.*;
import java.awt.event.*;
import com.examples.dsos.JDBCDSO.*;

public class dsoEditTableData
implements     AgiInitDatas,

        private Vector _ag_children = new Vector();
        private Vector _ag_names = new Vector();
        private String _ag_dbname = null;

        public dsoEditTableData()
        //==== Warning: SilverStream-generated method: do not edit. All changes will be lost ===


        public void ag_initDataStores(AgoBusinessObjectEvent e) throws Exception
        //==== Warning: SilverStream-generated method: do not edit. All changes will be lost ===

        public void invokeQuery(AgoDataSourceEvent evt) throws Exception

                String dbName = "TelApp";    //    (String) htParms.get("DBNAME");
                String tableName = "PERSOON";//      (String) htParms.get("TABLENAME");

                //Hashtable htParms = (Hashtable) evt.getParameter();
                //String semail = (String) htParms.get("SEMAIL");

                AgiDatabase adb =  evt.getServer().getDatabase(dbName);
                if (adb==null)
                        throw new Exception ("DATABASE: " + dbName + " was not available!");

                java.sql.Connection conn = adb.getConnection (true);
                java.sql.Statement stmt = conn.createStatement();

                 java.sql.ResultSet rs = stmt.executeQuery ("select ACHTERNAAM,AANHEF_ID,VOORLETTERS,TUSSENVOEGSELS,ID,EMAIL from " + tableName +  " order by ACHTERNAAM");
                java.sql.ResultSetMetaData rsm = rs.getMetaData();


                //rsm = null;
                //rs = null;
                //stmt = null;
                adb.releaseConnection (conn);

        public char getDataTypeCode (int TYPE) {
                char retCode = ' ';
                switch (TYPE)  {
                case java.sql.Types.BIGINT                      : retCode = DatatypeCodes.TYPE_INT;             break;
                case java.sql.Types.BINARY                      : retCode = DatatypeCodes.TYPE_BYTEARRAY;       break;
                case java.sql.Types.BIT                         : retCode = DatatypeCodes.TYPE_BOOLEAN;         break;

                case java.sql.Types.CHAR                        : retCode = DatatypeCodes.TYPE_STRING;          break;
                case java.sql.Types.DATE                        : retCode = DatatypeCodes.TYPE_DATE;            break;
                case java.sql.Types.DECIMAL             : retCode = DatatypeCodes.TYPE_BIGDECIMAL;              break;
                case java.sql.Types.DOUBLE                      : retCode = DatatypeCodes.TYPE_DOUBLE;          break;
                case java.sql.Types.FLOAT                       : retCode = DatatypeCodes.TYPE_FLOAT;           break;
                case java.sql.Types.INTEGER             : retCode = DatatypeCodes.TYPE_INT;                     break;
                case java.sql.Types.LONGVARBINARY       : retCode = DatatypeCodes.TYPE_BYTEARRAY;       break;
                case java.sql.Types.LONGVARCHAR         : retCode = DatatypeCodes.TYPE_STRING;          break;
                case java.sql.Types.NULL                        : retCode = DatatypeCodes.TYPE_NONE;            break;
                case java.sql.Types.NUMERIC             : retCode = DatatypeCodes.TYPE_NUMERIC;         break;
                case java.sql.Types.OTHER                       : retCode = DatatypeCodes.TYPE_OTHER;           break;
                case java.sql.Types.REAL                        : retCode = DatatypeCodes.TYPE_FLOAT;           break;
                case java.sql.Types.SMALLINT            : retCode = DatatypeCodes.TYPE_INT;                     break;
                case java.sql.Types.TIME                        : retCode = DatatypeCodes.TYPE_TIME;            break;
                case java.sql.Types.TIMESTAMP           : retCode = DatatypeCodes.TYPE_TIMESTAMP;       break;
                case java.sql.Types.TINYINT             : retCode = DatatypeCodes.TYPE_INT;                     break;
                case java.sql.Types.VARBINARY           : retCode = DatatypeCodes.TYPE_BYTEARRAY;       break;
                case java.sql.Types.VARCHAR             : retCode = DatatypeCodes.TYPE_STRING;          break;
                return retCode;

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close