Who can explain to me this expression in Java

the method returns a boolean:
return (getClass() == i.getClass()) && (_title == null ? i._title == null : title.equals(i.title));
what is the use in "?" and ":", maybe demonstrate it to me in a simple example.
thanks

the method returns a boolean:
return (getClass() == i.getClass()) && (_title == null
? i._title == null : title.equals(i.title));
what is the use in "?" and ":", maybe demonstrate it
to me in a simple example.
thanksThis line
_title == null ? i._title == null : _title.equals(i._title)is equivalent to
if (_title == null) {
    i._title == null;
else {
    _title.equals(i._title)
}Check out http://www.devdaily.com/java/edu/pj/pj010018/ for a discussion of it.
Lee

Similar Messages

  • I will pay for who can help me with this applet

    Hi!, sorry for my english, im spanish.
    I have a big problem with an applet:
    I�ve make an applet that sends files to a FTP Server with a progress bar.
    Its works fine on my IDE (JBuilder 9), but when I load into Internet Explorer (signed applet) it crash. The applet seems like blocked: it show the screen of java loading and dont show the progress bar, but it send the archives to the FTP server while shows the java loading screen.
    I will pay with a domain or with paypal to anyone who can help me with this problematic applet. I will give my code and the goal is only repair the applet. Only that.
    My email: [email protected]
    thanks in advance.
    adios!

    thaks for yours anwswers..
    harmmeijer: the applet is signed ok, I dont think that is the problem...
    itchyscratchy: the server calls are made from start() method. The applet is crashed during its sending files to FTP server, when finish, the applet look ok.
    The class I use is FtpBean: http://www.geocities.com/SiliconValley/Code/9129/javabean/ftpbean/
    (I test too with apache commons-net, and the same effect...)
    The ftp is Filezilla in localhost.
    This is the code, I explain a little:
    The start() method calls iniciar() method where its is defined the array of files to upload, and connect to ftp server. The for loop on every element of array and uploads a file on subirFichero() method.
    Basicaly its this.
    The HTML code is:
    <applet
           codebase = "."
           code     = "revelado.Upload.class"
           archive  = "revelado.jar"
           name     = "Revelado"
           width    = "750"
           height   = "415"
           hspace   = "0"
           vspace   = "0"
           align    = "middle"
         >
         <PARAM NAME="usern" VALUE="username">
         </applet>
    package revelado;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;
    import java.io.*;
    import javax.swing.border.*;
    import java.net.*;
    import ftp.*;
    public class Upload
        extends Applet {
      private boolean isStandalone = false;
      JPanel jPanel1 = new JPanel();
      JLabel jLabel1 = new JLabel();
      JLabel jlmensaje = new JLabel();
      JLabel jlarchivo = new JLabel();
      TitledBorder titledBorder1;
      TitledBorder titledBorder2;
      //mis variables
      String DIRECTORIOHOME = System.getProperty("user.home");
      String[] fotos_sel = new String[1000]; //array of selected images
      int[] indice_tamano = new int[1000]; //array of sizes
      int[] indice_cantidad = new int[1000]; //array of quantitys
      int num_fotos_sel = 0; //number of selected images
      double importe = 0; //total prize
      double[] precios_tam = {
          0.12, 0.39, 0.60, 1.50};
      //prizes
      String server = "localhost";
      String username = "pepe";
      String password = "pepe01";
      String nombreusuario = null;
      JProgressBar jProgreso = new JProgressBar();
      //Obtener el valor de un par�metro
      public String getParameter(String key, String def) {
        return isStandalone ? System.getProperty(key, def) :
            (getParameter(key) != null ? getParameter(key) : def);
      //Construir el applet
      public Upload() {
      //Inicializar el applet
      public void init() {
        try {
          jbInit();
        catch (Exception e) {
          e.printStackTrace();
      //Inicializaci�n de componentes
      private void jbInit() throws Exception {
        titledBorder1 = new TitledBorder("");
        titledBorder2 = new TitledBorder("");
        this.setLayout(null);
        jPanel1.setBackground(Color.lightGray);
        jPanel1.setBorder(BorderFactory.createEtchedBorder());
        jPanel1.setBounds(new Rectangle(113, 70, 541, 151));
        jPanel1.setLayout(null);
        jLabel1.setFont(new java.awt.Font("Dialog", 1, 16));
        jLabel1.setText("Subiendo archivos al servidor");
        jLabel1.setBounds(new Rectangle(150, 26, 242, 15));
        jlmensaje.setFont(new java.awt.Font("Dialog", 0, 10));
        jlmensaje.setForeground(Color.red);
        jlmensaje.setHorizontalAlignment(SwingConstants.CENTER);
        jlmensaje.setText(
            "Por favor, no cierre esta ventana hasta que termine de subir todas " +
            "las fotos");
        jlmensaje.setBounds(new Rectangle(59, 49, 422, 30));
        jlarchivo.setBackground(Color.white);
        jlarchivo.setBorder(titledBorder2);
        jlarchivo.setHorizontalAlignment(SwingConstants.CENTER);
        jlarchivo.setBounds(new Rectangle(16, 85, 508, 24));
        jProgreso.setForeground(new Color(49, 226, 197));
        jProgreso.setBounds(new Rectangle(130, 121, 281, 18));
        jPanel1.add(jlmensaje, null);
        jPanel1.add(jlarchivo, null);
        jPanel1.add(jProgreso, null);
        jPanel1.add(jLabel1, null);
        this.add(jPanel1, null);
        nombreusuario = getParameter("usern");
      //Iniciar el applet
      public void start() {
        jlarchivo.setText("Start() method...");
        iniciar();
      public void iniciar() {
        //init images selected array
        fotos_sel[0] = "C:/fotos/05160009.JPG";
        fotos_sel[1] = "C:/fotos/05160010.JPG";
        fotos_sel[2] = "C:/fotos/05160011.JPG";
         // etc...
         num_fotos_sel=3; //number of selected images
        //conectar al ftp (instanciar clase FtpExample)
        FtpExample miftp = new FtpExample();
        miftp.connect();
        //make the directory
         subirpedido(miftp); 
        jProgreso.setMinimum(0);
        jProgreso.setMaximum(num_fotos_sel);
        for (int i = 0; i < num_fotos_sel; i++) {
          jlarchivo.setText(fotos_sel);
    jProgreso.setValue(i);
    subirFichero(miftp, fotos_sel[i]);
    try {
    Thread.sleep(1000);
    catch (InterruptedException ex) {
    //salida(ex.toString());
    jlarchivo.setText("Proceso finalizado correctamente");
    jProgreso.setValue(num_fotos_sel);
    miftp.close();
    //Detener el applet
    public void stop() {
    //Destruir el applet
    public void destroy() {
    //Obtener informaci�n del applet
    public String getAppletInfo() {
    return "Subir ficheros al server";
    //Obtener informaci�n del par�metro
    public String[][] getParameterInfo() {
    return null;
    //sube al ftp (a la carpeta del usuario) el archivo
    //pedido.txt que tiene las lineas del pedido
    public void subirpedido(FtpExample miftp) {
    jlarchivo.setText("Iniciando la conexi�n...");
    //make folder of user
    miftp.directorio("www/usuarios/" + nombreusuario);
    //uploads a file
    public void subirFichero(FtpExample miftp, String nombre) {
    //remote name:
    String nremoto = "";
    int lr = nombre.lastIndexOf("\\");
    if (lr<0){
    lr = nombre.lastIndexOf("/");
    nremoto = nombre.substring(lr + 1);
    String archivoremoto = "www/usuarios/" + nombreusuario + "/" + nremoto;
    //upload file
    miftp.subir(nombre, archivoremoto);
    class FtpExample
    implements FtpObserver {
    FtpBean ftp;
    long num_of_bytes = 0;
    public FtpExample() {
    // Create a new FtpBean object.
    ftp = new FtpBean();
    // Connect to a ftp server.
    public void connect() {
    try {
    ftp.ftpConnect("localhost", "pepe", "pepe01");
    catch (Exception e) {
    System.out.println(e);
    // Close connection
    public void close() {
    try {
    ftp.close();
    catch (Exception e) {
    System.out.println(e);
    // Go to directory pub and list its content.
    public void listDirectory() {
    FtpListResult ftplrs = null;
    try {
    // Go to directory
    ftp.setDirectory("/");
    // Get its directory content.
    ftplrs = ftp.getDirectoryContent();
    catch (Exception e) {
    System.out.println(e);
    // Print out the type and file name of each row.
    while (ftplrs.next()) {
    int type = ftplrs.getType();
    if (type == FtpListResult.DIRECTORY) {
    System.out.print("DIR\t");
    else if (type == FtpListResult.FILE) {
    System.out.print("FILE\t");
    else if (type == FtpListResult.LINK) {
    System.out.print("LINK\t");
    else if (type == FtpListResult.OTHERS) {
    System.out.print("OTHER\t");
    System.out.println(ftplrs.getName());
    // Implemented for FtpObserver interface.
    // To monitor download progress.
    public void byteRead(int bytes) {
    num_of_bytes += bytes;
    System.out.println(num_of_bytes + " of bytes read already.");
    // Needed to implements by FtpObserver interface.
    public void byteWrite(int bytes) {
    //crea un directorio
    public void directorio(String nombre) {
    try {
    ftp.makeDirectory(nombre);
    catch (Exception e) {
    System.out.println(e);
    public void subir(String local, String remoto) {
    try {
    ftp.putBinaryFile(local, remoto);
    catch (Exception e) {
    System.out.println(e);
    // Main
    public static void main(String[] args) {
    FtpExample example = new FtpExample();
    example.connect();
    example.directorio("raul");
    example.listDirectory();
    example.subir("C:/fotos/05160009.JPG", "/raul/foto1.jpg");
    //example.getFile();
    example.close();

  • Who can explain inner class to me?

    //InheritInner.java
    //Inheriting an inner class
    class WithInner
         class Inner{
              Inner()
              {System.out.println("Inner class");
         WithInner()
         {System.out.println("WithInner");}
    public class InheritInner extends WithInner.Inner
         //!InheritInner(){}//Won't compile
         InheritInner(WithInner wi)
              wi.super();
         public static void main(String[] args)
              WithInner wi=new WithInner();
              InheritInner ii=new InheritInner(wi);
    Who can explain this subclass constructor to me?
    I appreciate your help!

    Here's the class that in 'Thinking in Java'. For some reason, yours is completely different.
    //: InheritInner.java
    // Inheriting an inner class
    class WithInner {
      class Inner {}
    public class InheritInner
        extends WithInner.Inner {
      //! InheritInner() {} // Won't compile
      InheritInner(WithInner wi) {
        wi.super();
      public static void main(String[] args) {
        WithInner wi = new WithInner();
        InheritInner ii = new InheritInner(wi);

  • I need to download ferefox 9.0 but I cannot find it anywhere. Who can help me with this?

    I need to download ferefox 9.0 but I cannot find it anywhere. Who can help me with this?

    Please note that running out of date versions of Firefox is not recommended, as you will open yourself up to known security issues, alongside bugs and other issues. Is there a specific problem you are having with Firefox that I can help you with?
    You can download Firefox 9 at [http://ftp://ftp.mozilla.org/pub/firefox/releases/9.0.1/win32/en-US/ ftp://ftp.mozilla.org/pub/firefox/releases/9.0.1/win32/en-US/]

  • Error Message:"Cannot find or create the font 'WP-MathA'. Some characters may not display or print correctly."  Who can help me solve this problem?

    Some of the pdf files I work with (receive) come up with a comment: “Cannot find or create the font ‘WP-MathA’. Some characters may not display or print correctly.”  Who can help me solve this problem?
    Thank you in advance for  your time.
    Marlen

    Hello Anubha,
    I am having a similar problem on my machine.  I was using Word 2008 and I created a PDF inside Word.
    I am opening the file on the system itself and I am running Windows 8.1.  I am using Version 11 of Reader.
    When the PDF I created (my resume) attempts to open, it says:  cannot find or create the file Times, Bold.  Some characters may not display or print correctly. 
    However, the entire Reader keeps freezing and will not allow me to open or test print the document.  Also, it is not displaying any of the Bold Times New Roman Print.  Can you please help?  Thanks.

  • Who can explain the message server string in the OSS connection ?

    Who can explain the message server string in the OSS connection ?  
    For example:
    MSG SERVER FIELD IS:
    /H/128.168.0.28/S/sapdp99/H/194.39.131.34/S/sapdp99/H/oss001
    What is the mean to each field in the string?
    What does the first "/H" mean?
    What does the second "/H" mean?
    What does the third "/H" mean?
    What does the first "/S" mean?
    What does the second "/S" mean?
    What does "/oss001" mean?
    Thanks .

    Hi,
    when you define  techinacal settings in tcode OSS1
    Transaction OSS1 -> Parameter -> Technical Settings -> Change -> Save. The SAPOSS destination is only automatically updated when you save.
    /H indicate server
    /S indicate Service
    check following SAP note
    Note 33135 - Guidelines for OSS1
    regards,
    kaushal

  • I thought I had  Adobe stuff.  I am not computer saavy at all, so I need to speak to someone who can guide me through this situation.  I thought I had an Adobe PDF File, but I guess not.  When I went to print taxes, the blank forms printed, but no the tax

    I thought I had Adobe stuff.  I am not computer savvy at all, so I need to speak to someone who can guide me through this situation.  I thought I had an Adobe PDF File, but I guess not.  When I went to print taxes, the blank forms printed, but no tax information I typed in. Please have someone call me.  My number is (909) 864-1150.  Thank you.

    Hello Bill,
    You can seek help from Adobe customer care for the same.
    Contact Customer Care
    Regards,
    Anubha

  • Who can help me with this form?

    Having some problems with the form ive placed on my site.
    I cant find the problem. Is there someone who can tell me what i have done wrong.
    you can see the form on.
    http://www.salontouche.nl/explorers.htm
    and the error i get is..
    Oops! This page appears broken. DNS Error - Server cannot be found.
    hope to get some advice..
    this is the contactscript..
    <?php error_reporting(0);
        // VALUES FROM THE FORM
        $name        = $_POST['name'];
        $email        = $_POST['email'];
        $message    = $_POST['msg'];
        // ERROR & SECURITY CHECKS
        if ( ( !$email ) ||
             ( strlen($_POST['email']) > 200 ) ||
             ( !preg_match("#^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)* )\.([A-Za-z]{2,})$#", $email) )
            print "Error: Invalid E-Mail Address";
            exit;
        if ( ( !$name ) ||
             ( strlen($name) > 100 ) ||
             ( preg_match("/[:=@\<\>]/", $name) )
            print "Error: Invalid Name";
            exit;
        if ( preg_match("#cc:#i", $message, $matches) )
            print "Error: Found Invalid Header Field";
            exit;
        if ( !$message )
            print "Error: No Message";
            exit;
    if ( strpos($email,"\r") !== false || strpos($email,"\n") !== false ){ 
            print "Error: Invalid E-Mail Address";
            exit;
        if (FALSE) {
            print "Error: You cannot send to an email address on the same domain.";
            exit;
        // CREATE THE EMAIL
        $headers    = "Content-Type: text/plain; charset=iso-8859-1\n";
        $headers    .= "From: $name <$email>\n";
        $recipient    = "[email protected]";
        $subject    = "Reactie van uw Website";
        $message    = wordwrap($message, 1024);
        // SEND THE EMAIL TO YOU
        mail($recipient, $subject, $message, $headers);
        // REDIRECT TO THE THANKS PAGE
        header("Location: http://www.salontouche.nl/thanks.php");
    ?>
    regards

    Having some problems with the form ive placed on my site.
    I cant find the problem. Is there someone who can tell me what i have done wrong.
    you can see the form on.
    http://www.salontouche.nl/explorers.htm
    and the error i get is..
    Oops! This page appears broken. DNS Error - Server cannot be found.
    hope to get some advice..
    this is the contactscript..
    <?php error_reporting(0);
        // VALUES FROM THE FORM
        $name        = $_POST['name'];
        $email        = $_POST['email'];
        $message    = $_POST['msg'];
        // ERROR & SECURITY CHECKS
        if ( ( !$email ) ||
             ( strlen($_POST['email']) > 200 ) ||
             ( !preg_match("#^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)* )\.([A-Za-z]{2,})$#", $email) )
            print "Error: Invalid E-Mail Address";
            exit;
        if ( ( !$name ) ||
             ( strlen($name) > 100 ) ||
             ( preg_match("/[:=@\<\>]/", $name) )
            print "Error: Invalid Name";
            exit;
        if ( preg_match("#cc:#i", $message, $matches) )
            print "Error: Found Invalid Header Field";
            exit;
        if ( !$message )
            print "Error: No Message";
            exit;
    if ( strpos($email,"\r") !== false || strpos($email,"\n") !== false ){ 
            print "Error: Invalid E-Mail Address";
            exit;
        if (FALSE) {
            print "Error: You cannot send to an email address on the same domain.";
            exit;
        // CREATE THE EMAIL
        $headers    = "Content-Type: text/plain; charset=iso-8859-1\n";
        $headers    .= "From: $name <$email>\n";
        $recipient    = "[email protected]";
        $subject    = "Reactie van uw Website";
        $message    = wordwrap($message, 1024);
        // SEND THE EMAIL TO YOU
        mail($recipient, $subject, $message, $headers);
        // REDIRECT TO THE THANKS PAGE
        header("Location: http://www.salontouche.nl/thanks.php");
    ?>
    regards

  • Since Ios 7 Update of my iPhone 5 I can not log into any WLAN any more - who can help to solve this major problem

    Hi all,
    I updated my iPhone 5 recently to IOS 7 - Since then I do not get any access to my home WLAN / WIFI with the iphone 5.
    At same time the iphone 3S and IPAD 1 of my wife (both IOS 5.x) still work fine in our homes WLAN / WIFI.
    Who can help to get my Iphone 5 with IOS 7 back to work in the home WIFI ?
    Thanks in advance for any possible solution.
    Best regards
    Dirk from Hamburg Germany

    Try this first.
    On the iPhone go to Settings > General > Reset and select Reset Network Settings.
    This will erase all saved wi-fi networks and settings.
    If no change after this, try resetting your modem and wireless router. Disconnect the router from the power source followed by disconnecting the modem from the power source. Wait a few minutes followed by powering your modem back on allowing it to completely reset before powering your wireless router back on allowing it to completely reset with the modem.

  • Who can explain how EJB connect to Oracle9i DB with DataSource?

    I have taken 4 days into this problem. I am developing EJB with J2EE1.3 and Oracle9i DB, I can connect to DB in code with DriverManager. But I want to use DataSource to connect to DB. I failed, I can not get new way to resolve it when I after try to connect with javax.sql.DataSource, oracle.jdbc.pool.OracleDataSource and oracle.jdbc.pool.OracleConnectionPoolDataSource.
    I have got different Exceptions when I coding different ways:
    one is:
    Caught an exception.
    java.rmi.ServerException: RemoteException occurred in server thread; nested exce
    ption is:
    java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: U
    nable to connect to database. com.sun.enterprise.resource.JdbcDataSource; nested
    exception is:
    javax.ejb.EJBException: Unable to connect to database. com.sun.enterpris
    e.resource.JdbcDataSource
    java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: Unable to
    connect to database. com.sun.enterprise.resource.JdbcDataSource; nested excepti
    on is:
    javax.ejb.EJBException: Unable to connect to database. com.sun.enterpris
    e.resource.JdbcDataSource
    javax.ejb.EJBException: Unable to connect to database. com.sun.enterprise.resour
    ce.JdbcDataSource
    <<no stack trace available>>
    the Other is:
    Caught an exception.
    java.rmi.ServerException: RemoteException occurred in server thread; nested exce
    ption is:
    java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: U
    nable to connect to database. makeConnection:Io Exception: Connection refused(DESCRIP
    TION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)
    ))); nested exception is:
    javax.ejb.EJBException: Unable to connect to database. makeConnection:Io
    Exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_
    STACK=(ERROR=(CODE=12505)(EMFI=4))))
    java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: Unable to
    connect to database. makeConnection:Io Exception: Connection refused(DESCRIPTION=(TM
    P=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)))); nes
    ted exception is:
    javax.ejb.EJBException: Unable to connect to database. makeConnection:Io
    Exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_
    STACK=(ERROR=(CODE=12505)(EMFI=4))))
    javax.ejb.EJBException: Unable to connect to database. makeConnection:Io Exception: C
    onnection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(E
    RROR=(CODE=12505)(EMFI=4))))
    <<no stack trace available>>
    My codes related are:
    private void makeConnection() throws NamingException, SQLException {
    try{
    InitialContext ic = new InitialContext();
    OracleConnectionPoolDataSource ocpds = (OracleConnectionPoolDataSource) ic.lookup(dbName);
    PooledConnection pc = ocpds.getPooledConnection();
    con = pc.getConnection();
    }catch(SQLException ex){
    throw new SQLException("makeConnection:" + ex.getMessage());
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    con = DriverManager.getConnection(
    "jdbc:oracle:thin:@172.28.200.43:1521:shcd",
    "lijun", "xiaotian"); */
    public void setEntityContext(EntityContext context) {
    this.context = context;
    try {
    makeConnection();
    } catch (Exception ex) {
    throw new EJBException("Unable to connect to database. " +
    ex.getMessage());
    I believe I set JNDI and config EJB right, because I can run it with Cloudscape DB all right.
    who can tell me where is my WRONG, or tell me how to connect to Oracle9i DB?

    Hi Jhlijun,
    I am facing the same problem at the moment. However, I am not using a pooled connection. The following is my code. I am trying to connect a stateless session bean to an Oracle 9i database with result being fed back to a jsp page.
    package Test;
    import javax.naming.*;
    import java.sql.*;
    import java.util.*;
    import javax.ejb.*;
    import javax.sql.DataSource;
    import javax.sql.*;
    public class TestSessionEJBbean extends java.lang.Object implements javax.ejb.SessionBean
    String q="Select NAMETITLE,NAMEFIRST,NAMELAST from People where PeopleRSN<100";
         protected boolean create() throws java.lang.Exception
    return true;
    public TestSessionEJBbean()
    {   // EJB constructors don't have a server context.
    private void unhandledEvent( String listenerName, String methodName, java.lang.Object event )
    // method for interface javax.ejb.SessionBean
    public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException
    // To Do
    // method for interface javax.ejb.SessionBean
    public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException
    // To Do
    // method for interface javax.ejb.SessionBean
    public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException
    // To Do
    // method for interface javax.ejb.SessionBean
    public void setSessionContext( javax.ejb.SessionContext parm0 ) throws javax.ejb.EJBException, java.rmi.RemoteException
    this._sessionContext = parm0;          // generated helper code
    // To Do
    * Test Method
    public String Test() throws javax.ejb.EJBException
    return "Hi! I am the SessionEjbBean.";
    * Session Context of this EJB.
    * Set in 'setSessionContext()' before any 'ejbCreate()' is executed.
    private javax.ejb.SessionContext _sessionContext;
    * ejbCreate Method
    public void ejbCreate() throws javax.ejb.EJBException, javax.ejb.CreateException
    try {
    create(); // This 'create()' is used for internal initialization.
    catch( java.lang.Exception __e) {
    System.err.println( __e.toString() + " " + __e.getMessage() );
    // TODO: implement
    * getDBConnection Method
         public sun.jdbc.rowset.CachedRowSet getDBConnection() throws javax.ejb.EJBException
         String testPrint = "Starting...";//Only to check output
         Connection conn;
         sun.jdbc.rowset.CachedRowSet crset=null;
         try {
              testPrint += "before new InitialContext()....";//Only to check output
              InitialContext ic = new InitialContext();
              DataSource ds = (DataSource)ic.lookup("java:comp/env/jdbc/coquit");
              testPrint += "before ds.getConnection()....";//Only to check output
              conn = ds.getConnection("coquit","coquit");          
                   testPrint += "before conn.createStatement()....";
                   Statement stmt=conn.createStatement();
                   testPrint += "before stmt.executeQuery(....)";
                   ResultSet rset = stmt.executeQuery(q);
                   testPrint += "before new sun.jdbc.rowset.CachedRowSet()";     
                   crset = new sun.jdbc.rowset.CachedRowSet();
                   testPrint += "before crset.populate(rset)";
                   crset.populate(rset);
                   rset.close();
                   stmt.close();
                   conn.close();
         } catch (NamingException ne) {
         System.out.println("TestSessionEJBbean::getDBConnection Naming Exception " + ne);
         }catch (Exception e){
         System.out.println(testPrint+"...TestSessionEJBbean::getDBConnectionException" + e);
         System.out.println("\n\n");
         e.printStackTrace();
         return crset;

  • Topic: Who can explain how EJB connect to Oracle9i DB with DataSource?

    I have taken 4 days into this problem. I am developing EJB with
    J2EE1.3 and Oracle9i DB, I can connect to DB in code with
    DriverManager. But I want to use DataSource to connect to DB. I
    failed, I can not get new way to resolve it when I after try to
    connect with javax.sql.DataSource,
    oracle.jdbc.pool.OracleDataSource and
    oracle.jdbc.pool.OracleConnectionPoolDataSource.
    I have got different Exceptions when I coding different ways:
    one is:
    Caught an exception.
    java.rmi.ServerException: RemoteException occurred in server
    thread; nested exception is:
    java.rmi.RemoteException: nested exception is:
    javax.ejb.EJBException: Unable to connect to database.
    com.sun.enterprise.resource.JdbcDataSource; nested
    exception is:
    javax.ejb.EJBException: Unable to connect to database.
    com.sun.enterprise.resource.JdbcDataSource
    java.rmi.RemoteException: nested exception is:
    javax.ejb.EJBException: Unable to
    connect to database. com.sun.enterprise.resource.JdbcDataSource;
    nested exception is:
    javax.ejb.EJBException: Unable to connect to database.
    com.sun.enterprise.resource.JdbcDataSource
    javax.ejb.EJBException: Unable to connect to database.
    com.sun.enterprise.resource.JdbcDataSource
    <<no stack trace available>>
    the Other is:
    Caught an exception.
    java.rmi.ServerException: RemoteException occurred in server
    thread; nested exception is:
    java.rmi.RemoteException: nested exception is:
    javax.ejb.EJBException: Unable to connect to database.
    makeConnection:Io Exception: Connection refused(DESCRIPTION=
    (TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=
    (CODE=12505)(EMFI=4)
    ))); nested exception is:
    javax.ejb.EJBException: Unable to connect to database.
    makeConnection:Io
    Exception: Connection refused(DESCRIPTION=(TMP=)
    (VSNNUM=150999297)(ERR=12505)(ERROR_
    STACK=(ERROR=(CODE=12505)(EMFI=4))))
    java.rmi.RemoteException: nested exception is:
    javax.ejb.EJBException: Unable to
    connect to database. makeConnection:Io Exception: Connection
    refused(DESCRIPTION=(TM
    P=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)
    (EMFI=4)))); nested exception is:
    javax.ejb.EJBException: Unable to connect to database.
    makeConnection:Io
    Exception: Connection refused(DESCRIPTION=(TMP=)
    (VSNNUM=150999297)(ERR=12505)(ERROR_
    STACK=(ERROR=(CODE=12505)(EMFI=4))))
    javax.ejb.EJBException: Unable to connect to database.
    makeConnection:Io Exception: C
    onnection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)
    (ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
    <<no stack trace available>>
    My codes related are:
    private void makeConnection() throws NamingException,
    SQLException {
    try{
    InitialContext ic = new InitialContext();
    OracleConnectionPoolDataSource ocpds =
    (OracleConnectionPoolDataSource) ic.lookup(dbName);
    PooledConnection pc = ocpds.getPooledConnection();
    con = pc.getConnection();
    }catch(SQLException ex){
    throw new SQLException("makeConnection:" + ex.getMessage());
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    con = DriverManager.getConnection(
    "jdbc:oracle:thin:@172.28.200.43:1521:shcd",
    "lijun", "xiaotian"); */
    public void setEntityContext(EntityContext context) {
    this.context = context;
    try {
    makeConnection();
    } catch (Exception ex) {
    throw new EJBException("Unable to connect to database. " +
    ex.getMessage());
    I believe I set JNDI and config EJB right, because I can run it
    with Cloudscape DB all right.
    who can tell me where is my WRONG, or tell me how to connect to
    Oracle9i DB?

    Hi,
    on small thing to check (or perhaps do):
    Make sure that you are using the JDBC drivers from the Oracle9i
    DB client e.g. copy the classes12.jar from the ORACLE_HOME of
    the database client into OC4J_HOME lib.
    Also, one thing that might help is to define an explict Oracle
    datasource e.g.
    - Set class to value of Oracle DataSource class
    - Use only the location logical name
    - Returns Oracle implementation of java.sql.Connection
    <data-source
    class="oracle.jdbc.pool.OracleDataSource"
    name="jdbc/oracle/PooledDS"
    location="jdbc/oracle/PooledDS"
    username="scott"
    password="tiger"
    url="jdbc:oracle:thin:@<host>:<port>:<SID>"
    />
    Andy

  • Who can explain vod hds-vod ?

         In fms.ini
              VOD_COMMON_DIR = d:\Program Files\Adobe\Flash Media Server 4.5\webroot\vod
              VOD_DIR = d:\Program Files\Adobe\Flash Media Server 4.5\applications\vod\media
         In Apache httpd.conf
              DocumentRoot "../webroot"
         <Location /vod>
             HttpStreamingContentPath "../webroot/vod"
         </Location>
         <Location /hls-vod>
              HttpStreamingContentPath "../webroot/vod"
         </Location>
         Which path is used, when I used "http://localhost:8134/vod/xxx.mp4" to play?
         I change the path  to
         <Location /vod>
             HttpStreamingContentPath "D:\"
         </Location>
         There have no file In the path "D:\" .
         I used  "http://localhost:8134/vod/xxx.mp4" to play, why  the player still play the xxx.mp4?
         I am confused.
         Who can help me to explain these path mean?
         thanks!

    http://localhost:8134/vod/mp4:xxx.mp4

  • Who can explain this? No Solution required!

    I had like to see the explanation for the following. Personallyl, I am hoping that the Line Managment 'DLM' will realize that my line is capable of more than 77.43 and raise it to 79+. I hate it when people tell me the maximum you can get on your line is the 96% of the syncing speed e.t.c. If you have any insight on this, I would really appreciate that.
    Thank you.
    If you can't look at the picture below in full resolution then please click here: http://i4.minus.com/i6GJAeU2YW5oP.png
    Here is a real life download speed test whilst using Netherland's proxy servers from London. As you can see that not only the file is being download but Onlive is starting up at the same time. 9.947 MB/sec is equal to 79.576MB download speed. 
    If you can't look at the picture below in full resolution then please click here: 
    http://i4.minus.com/iYq6xXcQLF6F0.png

    john46 wrote:
    "I had like to see the explanation for the following. Personallyl, I am hoping that the Line Managment 'DLM' will realize that my line is capable of more than 77.43 and raise it to 79+. I hate it when people tell me the maximum you can get on your line is the 96% of the syncing speed e.t.c. If you have any insight on this, I would really appreciate that."
    You will never achieve a greater speed than the 77.43 mb IP profile as that is the maximum speed whether you like the answer or not you will never get more than 96% of the sync speed 
    so, does that mean it does not have any effect on what my actual download speed is?
    I just did another speed test and the result was 78.7?
    Your wording doesn't explain how I can download at a faster speed then what I am limited too.

  • Question on me51n: who can explain this phenomenon?

    Hi all,
    I am creating a Purchase Requisition via me51n.
    When I fill a 'K' or 'P' in the "acct assignment cat."(A) column in the Header Block. it will automatically bring me to the "Account Assignment" in the Item block, and give the "G/L account no" a default value 400000.
    I dont know why it give me the default value? can someone explain this to me, and where can I set up the configuration for the default value. I tried this in some other system, no such issues.
    Any response will be awarded.
    Thanks and regards,
    Samson

    hi,
    this is because an account modification key is maintained in your account assignemnet.
    please check the same in(OME9)
    say for example if VBR is maintained there check the sane in OBYC where correspondent to that account modification key same GL is maintained which it appears in your PR/PO
    VBR will be there in GBB Transaction key in OBYC
    Edited by: manipal on Dec 28, 2007 9:49 AM

  • Any danes who can explain what this is about.

    Got this message from controlling the disc....
    Kontrollerer enheden “Macintosh HD”
    Kontrollerer HFS Plus-enhed.
    Kontrollerer Extents Overflow-arkiv.
    Kontrollerer katalogarkiv.
    Kontrollerer arkiver med mange forbindelser.
    Kontrollerer kataloghierarkiet.
    Kontrollerer arkivet Extended Attributes.
    Kontrollerer enhedens bitmap.
    Enhedens bit map kræver en mindre reparation
    Kontrollerer oplysninger om enheden.
    Ugyldigt antal ledige blokke på enhed
    (Det burde være 14099383 i stedet for 14096227)
    Enheden Macintosh HD skal repareres.
    Fejl: Den underliggende opgave rapporterede en fejl ved ****
    1 HFS-enhed undersøgt
    Enheder skal repareres

    Hi snetiger,
    Have you installed the "Battery Update" from the Apple site? Has the battery been replaced through the battery program? Check the Magsafe plug. Is it melting? Do you have access to another charger to eliminate a bad charger? Does the orange charge light coming on or the green power adapter mode light? Have you unplugged the charger from the wall for about 60 secs. (if no lights, this resets charger) What are your energy saver preferences set to?
    I have been dealing with this battery issue across three different machines. I think it is a time formatting issue with the software. Keep an eye on the clock. Most of my worst issues have always occurs when the battery is "Calculating Until Full" this can go on for a while unless I unplug the Magsafe or open energy saver. Just opening it not having to change any settings.
    Sweet Polly

Maybe you are looking for