× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: Problems fetching data when passing AS400 object to Connection.connect()
  • From: "Vijosh A." <vijosh@xxxxxxxxxxxx>
  • Date: Thu, 5 Apr 2001 21:14:26 +0530
  • Importance: Normal

Thanx David. It worked well.

As far as using Tool Box is concerned, well we use a combination of Trigger
at the Keystore file and Data Queue for generating ID's. The calling Java
Program then picks up the unique ID and forms its Unique Key.

This could have been done using Individual Triggers for all files that
require an the ID and the trigger inturn picking from the Key Store file.
or
By using Commit and Roll Back to prevent Duplication of ID's.

Both are big overheads on the AS400. On the AS400 each session has a lock
and it keeps on increasing too.

So we make separate plugins  in cases where tool box classes are used and
then for cross platforms these plugins are replaced with platform
independent plugins.

thanx once again.

Cheers
Vijosh

-----Original Message-----
From: owner-java400-l@midrange.com
[mailto:owner-java400-l@midrange.com]On Behalf Of Dave Wall
Sent: Wednesday, April 04, 2001 7:08 PM
To: JAVA400-L@midrange.com
Subject: Re: Problems fetching data when passing AS400 object to
Connection.connect()



You must be using JTOpen 2.x since you are using the connect method that
takes an AS400 object.  Note there are methods that take more than just an
AS400 object.  The one of interest to you is the one that takes a
properties object and a default schema.  With this method you can set
various JDBC properties plus define the default library.  For example,
   void AS400Ctor()
   {
      try
      {
         AS400 system = new AS400("my_system", "my_id", "my_pwd");

         Properties p = new Properties();
         p.put("naming", "SQL");

         AS400JDBCDriver d = new AS400JDBCDriver();
         Connection c = d.connect(system, p, "QIWS");
         Statement s = c.createStatement();

         ResultSet rs = s.executeQuery("SELECT * FROM QCUSTCDT");

         while (rs.next())
         {
            String s1 = rs.getString("LSTNAM");
            String s2 = rs.getString("CITY");
            System.out.println(s1 + " " + s2);
         }

         s.close();
         c.close();
      }
      catch (Exception e) { e.printStackTrace(); }
   }


As important is why are you using the connect method that takes an AS400
object?  This is a "feature" that works only with the Toolbox driver so it
won't be portable.

David Wall
AS/400 Toolbox for Java


"Vijosh A." <vijosh@systsoft.com>@midrange.com on 04/04/2001 05:40:52 AM

Please respond to JAVA400-L@midrange.com

Sent by:  owner-java400-l@midrange.com


To:   <JAVA400-L@midrange.com>
cc:
Subject:  Problems fetching data when passing AS400 object to
      Connection.connect()





My application requires a System connection (for accessing data
queues..etc.)  as well as Database connection. The user has to login once.
This is to make the  AS400 object. This object is passed into the
Connection class.

   com.ibm.as400.access.AS400JDBCDriver d = new
com.ibm.as400.access.AS400JDBCDriver();
   com.ibm.as400.access.AS400 x =  new     com.ibm.as400.access.AS400
("myserver",userID,passWord);
    x.setGuiAvailable(false);
 Connection c = d.connect  (x);

Now to fetch using SQL with this connection I need to build  my SQL in the
following way  -
        "select * from  mylibrary.filename  ( I need to give the library
name, although Library  list for QUSER and the user's JOBD is set to -
mylibrary

Whereas if I have the connection in the following way

        Connection  c
=  DriverManager.getConnection"jdbc:as400://myserver/mylibrary","username","
password")

Then  I can write my SQL statements in the following way  -
        "Select  * from filename. ( Here I do not need to give the library
name)

Can anyone suggest a way by which I can avoid giving library name in   SQL
statements in the first case (i.e. Connection c=d.connect(x) ?

Thanx

Cheers

Vijosh








+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---



--------------------------------------------------------------
Systems & Software, Mumbai, India
  
     Sent using "The PostMaster" by QuantumLink Communications
   
   One Internet account, unlimited personal e-mail addresses
Get your free copy of "The PostMaster" at http://www.qlcomm.com/ 


+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.