× 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: JDBC Problems
  • From: "Joe Pluta" <joepluta@xxxxxxxxxxxxxxxxx>
  • Date: Wed, 31 Jan 2001 21:22:12 -0600
  • Importance: Normal

Okay, if

  Connection conn  =
  java.sql.DriverManager.getConnection("jdbc:as400://KITS01");

Gives you the error "cannot convert", then it means it is picking up a
Connection class from some package OTHER than java.sql.  This implies VERY
strongly that you have another Connection class in your workspace.  Find it
and kill it <grin>.

Anyway, until you resolve THAT particular issue, the following line SHOULD
work:

  java.sql.Connection conn  =
  java.sql.DriverManager.getConnection("jdbc:as400://KITS01");

This simply qualifies the Connection class and forces it to the java.sql
package when defining the variable "conn".  This is not the prettiest
technique in the world, but it's functional (I use it in JavaServer Pages,
because I've never gotten around to figuring out the @IMPORT syntax).

Joe Pluta
Itinerant Java/400 Merchant

> -----Original Message-----
> From: owner-java400-l@midrange.com
> [mailto:owner-java400-l@midrange.com]On Behalf Of Maarten Vries, de
> Sent: Wednesday, January 31, 2001 2:25 AM
> To: JAVA400-L@midrange.com
> 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
> +---
>

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