Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I have learned more through this forum than I did on a two day course. Thanks to everyone for their help and other postings that I have found useful..."

Geography

Where in the world do Tek-Tips members come from?
Helpful Member!  sumathy (MIS)
9 Jul 00 22:33
Hi!,
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!!!
010101 (Programmer)
24 Apr 01 8:59
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,
        AgiDataSourceListener
{


        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 ===

        return;
    }

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

        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();

                evt.setResultSet(rs);
                evt.setResult("succes");

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

        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;
        }
}



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!

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