Here's my example. What imports do you have at the top of your source?
Perhaps worth moving java,sql.* to the top (I assume the compiler will then
pick that up rather than another Connection class, but someone more expert
in Java than me may disagree - once the compiler has picked up the right
class my understanding is that you'll be OK at run time).

...

import java.sql.*;

...

  private String ERPJDBCDriver = null;
  private String ERPSystemName = null;
  private String ERPUser = null;
  private String ERPPassword = null;  [these values are read in from an XML
 message in my application]
...

    Connection conn = null;
...

    // Register correct JDBC driver
    try
    {
      System.err.println("Registering selected JDBC driver " +
ERPJDBCDriver);
      if (ERPJDBCDriver.compareTo("as400") == 0)
Class.forName("com.ibm.as400.access.AS400JDBCDriver");
      else if (ERPJDBCDriver.compareTo("odbc") == 0)
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      else if (ERPJDBCDriver.compareTo("db2") == 0)
Class.forName("com.ibm.db2.jdbc.app.DB2Driver");
    } catch (Exception e)
      {
        System.err.println("Couldn't register JDBC driver: " + e);
        return "JDBCERR";
      } // end catch

    // Connect to destination machine
    try
    {
      System.err.println("Connecting to destination machine " +
ERPSystemName + " using : " + ERPUser + " with password : " + ERPPassword);
      conn = DriverManager.getConnection("jdbc:" + ERPJDBCDriver + ":" +
ERPSystemName, ERPUser, ERPPassword);
    } catch (Exception e)
      {
        System.err.println("Connection Exception: " + e);
        return "CONNERR";
      } // end catch

...






"Maarten Vries, de" <m_devries74@hotmail.com> on 31/01/2001 08:25:02

Please respond to JAVA400-L@midrange.com

To:   JAVA400-L@midrange.com
cc:    (bcc: Mandy Shaw/Pacific/UK)
Subject:  RE: JDBC Problems




Joe

I downloaded Visual Age for Java 2.0 Prof. and that gives me the same
error.
Compiling on the AS/400 V4R4 gives me the same error. The JT400.jar is in
my
classpath.
This is all getting very strange, anybody have a sample for me using JDBC
to
connect to an AS/400?

Maarten


>From: "Joe Teff" <JoeTeff@earthlink.net>
>Reply-To: JAVA400-L@midrange.com
>To: <JAVA400-L@midrange.com>
>Subject: RE: JDBC Problems
>Date: Tue, 30 Jan 2001 16:23:31 -0600
>
>I was going to reply in about the same words. I've never had to
>cast this and I can't see how that would help. You are using
>VA for Java 1.1? That's pretty old. What version of Java does
>VA/Java 1.1 use? Connection, ResultSet, Statement, etc. are
>all interfaces. Try compiling and running outside of VA/Java
>and see what happens. Make sure that jt400.jar is in your
>CLASSPATH.
>
>Joe Teff
>
>-----Original Message-----
>From: owner-java400-l@midrange.com
>[mailto:owner-java400-l@midrange.com]On Behalf Of Clapham, Paul
>Sent: Tuesday, January 30, 2001 3:14 PM
>To: JAVA400-L@midrange.com
>Subject: RE: JDBC Problems
>
>
>I'm not so sure about that.  The compiler message says you can't convert
>from java.sql.Connection to Connection, so I don't think an explicit cast
>will help.  Anyway, I never have to do that in my SQL programs.
>
>The question is:  If the compiler thinks Connection is not
>java.sql.Connection, then what is it?  Sounds like there's another
>unrelated
>Connection class kicking around in the classpath.
>
>PC2
>
>-----Original Message-----
>From: Nick.Vrtis@alticor.com [mailto:Nick.Vrtis@alticor.com]
>Sent: January 30, 2001 11:44
>To: JAVA400-L@midrange.com
>Subject: Re: JDBC Problems
>
>
>
>Duh!... as he hits himself for not reading...Try
>
>  conn = (Connection) java.sql.DriverManager.getConnection
>("jdbc:as400://KITS01");
>
>and do the cast explicitly.  You are getting a compiler error correct?
Not
>a run time exception?
>
>Nick
>
>
>
>
>"Maarten Vries, de" <m_devries74@hotmail.com>@midrange.com on 01/30/2001
>01:30:48 PM
>
>Please respond to JAVA400-L@midrange.com
>
>Sent by:  owner-java400-l@midrange.com
>
>
>To:   JAVA400-L@midrange.com
>cc:
>
>Subject:  Re: JDBC Problems
>
>
>Duncan
>
>When I do the try (as in this email)
>I get the same error: cannot convert from java.sql.Connection to
>Connection.
>I use Visual Age for Java 1.1
>
>Maarten
>+---
>| 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
>+---
>
>+---
>| 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
>+---

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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
+---



      Regards,
      Mandy Shaw

      Catalyst Solutions plc
      Kingfisher House
      Frimley Business Park
      Camberley
      Surrey
      GU16 5SG
      UK

      http://www.catalyst-solutions.com
      Email: Mandy.Shaw@uk.catalyst-solutions.com

      Telephone: +44 (0)870 166 1000
      DDI: +44 870 166 1324
      Facsimile: +44 870 168 3920
      Mobile: +44 410 447966






----------------------------------------------------------------------
Catalyst Solutions plc.  Registered No 2918101.
Registered @ Kingfisher House, Frimley Business Park, Frimley,
Surrey. GU16 5SG   U.K.

NOTICE:
This message is intended only for the named addressee(s) and may
contain confidential and/or privileged information. If you are not the
named addressee you should not disseminate, copy or take any action
or place any reliance on it. If you have received this message in error
please notify postmaster@catalyst-solutions.com and delete the message
and any attachments accompanying it immediately.
----------------------------------------------------------------------


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


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

This mailing list archive is Copyright 1997-2022 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.