× 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.



Colin,

The two drivers do behave differently but the differences are
manageable. I would avoid exception handling for normal processing;
instead you could use the os.name System property. Here is a simple
connection class I use to treat connections more generically:
http://cvs.sourceforge.net/viewcvs.py/iseries-toolkit/span/src/org/iseriestoolkit/database/AS400ConnectionManager.java?view=markup

If you go back to the database directory, you can find the interface
and related classes.

David Morris

>>> colin.williams@xxxxxxxxxxxx 6/1/2004 1:35:59 PM >>>
Martin,

I can definitely say that the toolbox driver and the native driver do
not
work the same. ive been caught by this a couple of times.

If this is gonna be a cross-platform app, where the app could be one
platform or box, and the database another as400, i think your going to
have
to use the toolbox driver.

I have tried to use the driver option on the toolbox driver in the
past,
that is supposed to auto-magically select the toolbox driver for a
remote db
connect, or the native driver for a local db connect, but because the
native
and the toolbox drivers specify there properties in different ways,
unless
your using the default properties, it just doesnt work.

You could also try using the native driver first, in a try/catch block,
and
falling back to the toolbox driver if that throws and exception.

Are you externalising all your db connection values
(driver,url,userid,password etc) from the application so that you can
change
them as necessary?

still kicking around at misys, are many of the old faces still there?

cheers
Colin.W


----- Original Message ----- 
From: "McCallion, Martin" <martin.mccallion@xxxxxxxxx>
To: "'Java Programming on and around the iSeries / AS400'"
<java400-l@xxxxxxxxxxxx>
Sent: Tuesday, June 01, 2004 3:09 PM
Subject: RE: Connecting to the iSeries DB using a user with no
password


> Colin Williams wrote:
>
> > Is this a local connection to the database, or is this from
> > another system,
> > as I don't think that local connections need a userid or password,
> > they can use the current user profile to connect?
>
> Colin, thanks for your suggestions.  Sorry it has taken me so long to
get
> back to this.  This is, indeed, a local connection, though the
application
> is designed to run on multiple platforms, so I don't want to
introduce too
> much iSeries-specific stuff.
>
> > con =
> > DriverManager.getConnection("jdbc:db2:*local",
> > properties);
>
> I can get this to work, as I can the jdbc:db2://localhost form of the
URL,
> and indeed, the version I'm accustomed which specifies the name of
the SQL
> collection (= library) on the URL, like this:
> jdbc:db2://localhost/library-name.
>
> All well and good.  However, it seems to me that I ought to be able
to do
> the same thing when using the toolbox driver with native
optimisations.
So
> using a URL like jdbc:as400://localhost/library-name, after loading
> com.ibm.as400.access.AS400JDBCDriver, should work.  However, instead
I get
> an SQLException saying "Password is *NONE" (see stack trace below).
>
> Now, we can tell our clients that they should use the native driver;
but I
> think that both drivers ought to behave in the same way here, and
that the
> native driver is doing the correct thing.  Others may disagree, of
course.
> I would be particularly interested to hear from the Toolbox
developers who
> sometimes post here; or anyone who has any ideas about how to get
round
> this, of course.
>
> Note also that I get the same results when I call
> DriverManager.getConnection(url) as when I call
> DriverManager.getConnection(url, user, password) with null values for
user
> and password, or with "*CURRENT" for user and password.
>
> Here's the stack trace when I use the Toolbox driver with native
> optimisations:
>
> java.sql.SQLException: The application server rejected the
> connection.(Password is *NONE.)
>       java/lang/Throwable.<init>(Ljava/lang/String;)V+4
(Throwable.java:85)
>       java/lang/Exception.<init>(Ljava/lang/String;)V+1
(Exception.java:33)
>
java/sql/SQLException.<init>(Ljava/lang/String;Ljava/lang/String;I)V+1
> (SQLException.java:34)
>
>
com/ibm/as400/access/JDError.throwSQLException(Ljava/lang/String;Ljava/lang/
> Exception;)V+66 (JDError.java:480)
>
>
com/ibm/as400/access/AS400JDBCConnection.setProperties(Lcom/ibm/as400/access
>
/JDDataSourceURL;Lcom/ibm/as400/access/JDProperties;Lcom/ibm/as400/access/AS
> 400;)V+10 (AS400JDBCConnection.java:2738)
>
>
com/ibm/as400/access/AS400JDBCDriver.prepareConnection(Lcom/ibm/as400/access
>
/AS400;Lcom/ibm/as400/access/JDDataSourceURL;Ljava/util/Properties;Lcom/ibm/
> as400/access/JDProperties;)Ljava/sql/Connection;+56
> (AS400JDBCDriver.java:807)
>
>
com/ibm/as400/access/AS400JDBCDriver.initializeConnection(Lcom/ibm/as400/acc
>
ess/JDDataSourceURL;Lcom/ibm/as400/access/JDProperties;Ljava/util/Properties
> ;)Ljava/sql/Connection;+365 (AS400JDBCDriver.java:698)
>
>
com/ibm/as400/access/AS400JDBCDriver.connect(Ljava/lang/String;Ljava/util/Pr
> operties;)Ljava/sql/Connection;+82 (AS400JDBCDriver.java:285)
>
>
java/sql/DriverManager.getConnection(Ljava/lang/String;Ljava/util/Properties
> ;Ljava/lang/ClassLoader;)Ljava/sql/Connection;+144
(DriverManager.java:512)
>
>
java/sql/DriverManager.getConnection(Ljava/lang/String;Ljava/lang/String;Lja
> va/lang/String;)Ljava/sql/Connection;+37 (DriverManager.java:172)
>
> Cheers,
>
> Martin.
>
> -- 
> Martin McCallion
> Senior Technical Consultant
> Misys Wholesale Banking Systems
> 1 St George's Road, London, SW19 4DR, UK
> T +44 (0)20 8486 1951
> F +44 (0) 20 8947 3373
> martin.mccallion@xxxxxxxxx 
> www.misys.com 
>
> This email and any attachments have been scanned for known viruses
using
> multiple scanners. We believe that this email and any attachments
are
virus
> free, however the recipient must take full responsibility for virus
> checking. This email message is intended for the named recipient
only. It
> may be privileged and/or confidential. If you are not the intended
named
> recipient of this email then you should not copy it or use it for
any
> purpose, nor disclose its contents to any other person. You should
contact
> the Misys Banking and Securities Division as shown below so that we
can
take
> appropriate action at no cost to yourself.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.