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



Hi All.

I am using JDBC for data connectivity.  The class for database connectivity
compiles with no problem.  When I run the class, I receive an error.  Does
anyone have any ideas?

The error I receive:


  java.lang.NoClassDefFoundError

java/lang/ClassLoader.defineClass(Ljava/lang/String;[BIILjava/security/Prote
ctionDomain;)Ljava/lang/Class;+79 (ClassLoader.
  java:486)

java/net/URLClassLoader.defineClass(Ljava/lang/String;Lsun/misc/Resource;)Lj
ava/lang/Class;+196 (URLClassLoader.java:270)
        java/net/URLClassLoader$ClassFinder.run()Ljava/lang/Object;+42
(URLClassLoader.java:572)

java/net/URLClassLoader.findClass(Ljava/lang/String;)Ljava/lang/Class;+16
(URLClassLoader.java:198)

java/lang/ClassLoader.loadClass(Ljava/lang/String;Z)Ljava/lang/Class;+41
(ClassLoader.java:297)

sun/misc/Launcher$AppClassLoader.loadClass(Ljava/lang/String;Z)Ljava/lang/Cl
ass;+33 (Launcher.java:286)

java/lang/ClassLoader.loadClassInternal(Ljava/lang/String;)Ljava/lang/Class;
+1 (ClassLoader.java:313)



My JDBC code is as follows:



  private void connectDB()  {

      // register the driver
      try {
        Class.forName("com.ibm.db2.jdbc.app.DB2Driver");
      } catch (Exception e) {
        System.out.println("Exception at Class.forName \n" + e);
      }
      //  connection info - set the library too.....

      String userId = "TESTUSR";
      String password = "testpass";
      String url = "jdbc:db2:localhost/IPINFO";

      //  connect to the 400

      try {

      p.put("user", userId);
      p.put("password", password);

      c = DriverManager.getConnection(url,p);

    } catch (Exception e) {
      System.out.println("Connection problem");
      e.printStackTrace();
    } catch (NoClassDefFoundError ncl)  {
      System.out.println("No Class Found \n" + ncl);
    }

  }


================================

Mike Silvers
AS/400 Senior Programmer/Analyst
AS/400 IBM Certified RPG IV Developer
AS/400 IBM Certified Expert
Hainey Business Systems
8 E. Canal St
Dover, PA 17315
Branch Office:  (410) 397-8739
Phone:  (800) 932-3380
Fax:  (717) 292-9474
Web: http://www.hbs-inc.com
________________________________
Providing E-Commerce, EDI, AS/400
Development and related services
nationwide.
================================




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.