3 Replies Latest reply: Oct 12, 2013 2:37 PM by 978472 RSS

    Problems connecting to db2 in XletView

    843851
      Hi, my thesis is about Digital tv, and i'm using XletView on Ubuntu.
      I can't just find out what's the problem connecting to db2, and i really need help :(
      I've added to my classpath db2jcc.jar and all other jars i found in other forums, but i've always the same response:
      Here is my code:
      import java.sql.*;
      import javax.media.*;
      import javax.tv.xlet.*;
      import org.havi.ui.*;
      public class DVBEventsXlet      extends HContainer     implements Xlet, ControllerListener {
           private static final long serialVersionUID = 1L;
           private XletContext contextav;
           public void initXlet(XletContext ctx)
                throws XletStateChangeException {
                this.contextav = ctx;
                String currentClassPath = System.getProperty( "java.class.path" );
           System.out.println( "Current Classpath: "+ currentClassPath );
           }
           public void startXlet() { 
                try {
                     Class.forName("com.ibm.db2.jcc.DB2Driver");
                     Connection connection = DriverManager.getConnection("jdbc:db2://localhost:50000/tesina","db2inst1","718229");
                     Statement statement = connection.createStatement();
                     statement.executeUpdate("INSERT INTO cliente (nome,cognome,via,citta,username,password) VALUES ('EMANUELE','BATTISTONI','COLLI PORTUENSI 543','ROMA','LELE','0532718229')");
                     statement.close();
                     connection.close();
                     }catch(Exception e){
                          e.printStackTrace();
                     }
           }
           public void pauseXlet() {
           }
           public void destroyXlet(boolean unconditional) {
           }
           public void controllerUpdate(ControllerEvent event) {
           }
      }

      And this is the error:

      java.lang.ClassNotFoundException
      at net.beiker.xletview.classloader.XletClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:169)
      at DVBEventsXlet.startXlet(DVBEventsXlet.java:16)
      at net.beiker.xletview.xlet.XletManager.resumeRequest(Unknown Source)
      at net.beiker.xletview.xlet.XletManager.run(Unknown Source)
      at java.lang.Thread.run(Thread.java:619)

      If i add mysql jars and do the same thing with Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); it works....i really don't know what to do...does XletClassLoader have problems with db2 jars?
      You're my only hope....Thanks in advance...and sorry for my english...