HELP NEEDED !! Null values in Database

Hi there !!
I need help with EJB 3.0 passing null values to database. The situation looks like that :
I have created EJB entity class called "Osoba.java", it is in relation
with "Rola.java" (one to many). Each Object of class Osoba can have
many Roles. Then I created "OsobaServiceBean.java " I included it with
metod "CreateUnregisteredOsoba(Osoba , Boolean)". From "flex" level I
call this bean - call is accepted, and as a result new object of class Osoba is added to database. Problem is that only one column is filled in table,
dispite that in service bean I enforce it to fill all columns (see
source code - file OsobaServiceBean.java , method
createUnregisteredOsoba() )
I provided source code here :
FILE Rola.java
package test.granite.ejb3.entity ;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
@Entity
public class Rola extends AbstractEntity {
private static final long serialVersionUID = 1L;
@Basic
private String login = new String("");
@Basic
private String rola = new String("");
@Basic
private String roleGroup = new String("");
@Basic
private Boolean zatwierdzony = new Boolean(false);
@ManyToOne(optional=false)
private Osoba osoba;
public Boolean getZatwierdzony() {
return zatwierdzony;
public void setZatwierdzony(Boolean zatwierdzony) {
this.zatwierdzony = zatwierdzony;
public String getLogin() {
return login;
public void setLogin(String login) {
this.login = login;
public String getRola() {
return rola;
public void setRola(String rola) {
this.rola = rola;
public Osoba getOsoba() {
return osoba;
public void setOsoba(Osoba osoba) {
this.osoba = osoba;
public String getRoleGroup() {
return roleGroup;
public void setRoleGroup(String roleGroup) {
this.roleGroup = roleGroup;
FILE Osoba.java
package test.granite.ejb3.entity ;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
@Entity
public class Osoba extends AbstractEntity {
private static final long serialVersionUID = 1L;
@Basic
private String imie;
@Basic
private String nazwisko;
@Basic
private String login;
@Basic
private String haslo;
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER,
mappedBy="osoba")
private Set<Rola> role = new HashSet<Rola>();
@Basic
private String email;
@Basic
private String nrTelefonu;
@Basic
private int rokStudiow;
public String getPelneImie() {
StringBuilder sb = new StringBuilder();
if (imie != null && imie.length() > 0)
sb.append(imie);
if (nazwisko != null && nazwisko.length() > 0) {
if (sb.length() > 0)
sb.append(' ');
sb.append(nazwisko);
return sb.toString();
public String getImie() {
return imie;
public void setImie(String imie) {
this.imie = imie;
public String getNazwisko() {
return nazwisko;
public void setNazwisko(String nazwisko) {
this.nazwisko = nazwisko;
public String getLogin() {
return login;
public void setLogin(String login) {
this.login = login;
public String getHaslo() {
return haslo;
public void setHaslo(String haslo) {
this.haslo = haslo;
public Set<Rola> getRole() {
return role;
public void setRole(Set<Rola> role) {
this.role = role;
public String getEmail() {
return email;
public void setEmail(String email) {
this.email = email;
public String getNrTelefonu() {
return nrTelefonu;
public void setNrTelefonu(String nrTelefonu) {
this.nrTelefonu = nrTelefonu;
public int getRokStudiow() {
return rokStudiow;
public void setRokStudiow(int rokStudiow) {
this.rokStudiow = rokStudiow;
FILE OsobaServiceBean.java
package test.granite.ejb3.service;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.security.RolesAllowed;
import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.Query;
import org.jboss.annotation.security.SecurityDomain ;
import test.granite.ejb3.entity.Osoba;
import test.granite.ejb3.entity.Rola;
@Stateless
@Local(OsobaService.class)
@SecurityDomain("other")
public class OsobaServiceBean extends AbstractEntityService implements
OsobaService{
private static final long serialVersionUID = 1L;
public OsobaServiceBean() {
super();
public List<Osoba> findAllOsoba() {
return findAll(Osoba.class);
@SuppressWarnings("unchecked")
public List<Osoba> findAllOsoba(String name) {
Query query = manager.createQuery (
"select distinct p from Osoba p " +
"where upper(p.imie) like upper('%" + name + "%')
or upper(p.nazwisko) like upper('%" + name + "%')"
return query.getResultList();
public Osoba createOsoba(Osoba person) { // pozwalamy
tworzyc zeby niezalogowany
return manager.merge (person); //
uzytkownik utworzyl osobe
} // ale
osoba ta i tak nie bedzie jeszcze
// zatwierdzona
@RolesAllowed({"unregistered"})
public Osoba createUnregisteredOsoba(Osoba person, boolean
zatwierdzony) {
Rola niezarejestrowany = new Rola();
niezarejestrowany.setRola("user");
niezarejestrowany.setOsoba(person);
niezarejestrowany.setRoleGroup("Roles");
niezarejestrowany.setLogin(person.getLogin());
niezarejestrowany.setZatwierdzony(zatwierdzony);
Set<Rola> role = new HashSet<Rola>();
role.add(niezarejestrowany);
// Arrays;
Object a[] = role.toArray();
Rola temp;
temp = (Rola)a[0];
System.out.println("Login = " + temp.getLogin() + //
added only for check !!
"Rola = " + temp.getLogin() +
"Zatwierdzony = " +
temp.getZatwierdzony() +
"Rolegroup = " + temp.getRoleGroup());
person.setRole (role);
return manager.merge(person); //
uzytkownik utworzyl osobe
} // ale
osoba ta i tak nie bedzie jeszcze
public Osoba modifyOsoba(Osoba person) {
return manager.merge(person);
@RolesAllowed({"admin"})
public void deleteOsoba(Osoba person) {
person = manager.find(Osoba.class, person.getId());
manager.remove(person);
public void deleteRola(Rola rola) {
rola = manager.find(Rola.class, rola.getId());
rola.getOsoba().getRole().remove(rola);
manager.remove(rola);
DATABASE LISTING :
-----------------------------------------------------------------+----------\
--------------------------------------------------------+
| id | ENTITY_UID | version | rola |
zatwierdzony | osoba_id | login | RoleGroup |
-----------------------------------------------------------------+----------\
--------------------------------------------------------+
| 1 | | NULL | unregistered |
| 0 | unregistered | Roles | NULL |
| 33 | eee91bd9-8c5f-4154-8260-3cac9a18eb97 | 0 | user |
| 34 | NULL | NULL |
| 32 | a7ed4e8d-a1ba-473a-921c-73c8f8f89efb | 0 | user |
| 33 | NULL | NULL |
-----------------------------------------------------------------+----------\
--------------------------------------------------------+
The row numer 1 is added by hand and it works. row number 33 and 32
are added to database by method CreateUnregisteredOsoba. As you can
see fields login as well as Roles and RoleGroup are empty (NULL). What
Im doing wrong ?
Thanks for your help -
Roman Kli&#347;
PS. Table Osoba works fine - everything is added as I want.

I solved problem.
The reason why EJB had not added anything to database NULL was becouse wrong names of class. Ive refactored whole class Rola.java to RolaClass.java and suddenly it worked.
True reason is still unknown but most importent is that it works.
Thanx for reading topic - hope next time someone will answer my questions.
By !!

Similar Messages

  • Need help with NULL values in Crosstables

    Hello everybody,
    I need some help with NULL values and crosstables. My issue is the following:
    I have a query (BW - MDX-Query) that gives me turnover measures for each month. In Crystal Reports I choose crosstable to display this whereby I put all month in columns and all turnover-measures in rows. Each month that has a value (measures are not empty) is chown in the crosstables rows. So far so good. The problem occures when there are month that actually have no values (measures are empty). In that case these months are not chown in columns. But I need CR to display these columns and show the value 0. How can I do that?

    Hi Frank,
    Cross tab shows the data based on your column and these column fields are grouped and based on the group it will show your summaries. 
    If there is no data for any of your group it will not display that group.  In this case you will have to create a standard report which should look like cross tab and to get zero values you need to write formulas .
    Example if you want to display Moth wise sales :
    if Month() = 01 Then
    sum() else 0
    Now this formula will check if your month is Jan, then it will sum up the values else it will display zero value. 
    This is possible only through standard report not with Cross Tab.
    Thanks,
    Sastry

  • Cannot Save NULL value to database

    I cannot save a null value through the data tab in the multi-row updates pane. It always gives me an error such as "Invalid number". It works fine through normal SQL update statement. Is there a preference somewhere to turn this on?
    thanks in advance
    Paul P

    Hi Paul,
    Just use the backspace key to obliterate any existing value -- that makes it null. Afterwards, if you refresh or close/reopen the object, the data tab will display any null as the value set in Tools | Preferences | Database | Advanced | Display Null Value As .
    Regards,
    Gary
    SQL Developer Team

  • Urgent help on null values

    hi
    every body
    i hope some body might have faced similar problem
    i have a database retrival problem and i am getting the values in the last row of the table,
    But the problem is if the value stored is "NULL" my program and application hangs
    can any body tell me how to handle this
    thanks in advance

    Hi Anilkumar
    if u r trying to retrieve from database then u must be using resultset to get the data. ResultSet has a method called wasNull() which returns boolean when the last column read had a value of SQL NULL. This shud solve your problem. If u get a null value dont process that column.
    -vinucon

  • Urgent help : Need to recover a database without backup and archivelogs

    Hi,
    We are in urgent need to recover a database without backup and archivelogs
    one datafile seems corrupted
    SQL> recover automatic database until cancel using BACKUP CONTROLFILE;
    ORA-00279: change 10527325422479 generated at 07/27/2011 03:13:04 needed for
    thread 1
    ORA-00289: suggestion : /pys/u5/oradata/PYS/PYSarch/arch0001.0000181845.arc
    ORA-00280: change 10527325422479 for thread 1 is in sequence #181845
    ORA-00278: log file '/pys/u5/oradata/PYS/PYSarch/arch0001.0000181845.arc' no
    longer needed for this recovery
    ORA-00308: cannot open archived log
    '/pys/u5/oradata/PYS/PYSarch/arch0001.0000181845.arc'
    ORA-27037: unable to obtain file status
    HP-UX Error: 2: No such file or directory
    Additional information: 3
    Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
    CANCEL
    ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
    ORA-01152: file 1 was not restored from a sufficiently old backup
    ORA-01110: data file 1: '/pys/u2/oradata/PYS/pay_system_01.dbf'

    N Gasparotto wrote:
    bsac14 wrote:
    my database is in no archive mode
    can you please tell how to restore
    yes it is a datafile corruptionYou did not say how you defined that's a datafile corruption. You provide minimum to zero information.
    I just need to bring the database up,no need any exact data
    I can refresh from prod laterThen drop and recreate database. Basically and since you are not in archive mode, no recover is possible. Period.
    Nicolas.Hi,
    How did you come to the conclusion that your datafile is corrupted? Can you provide and supported logs?
    Regards .....

  • Need help on Null value check function

    Hey guys,
    I need to create a function that will accept two values and perform a comparison on them and based on whether or not they're different, return true or false.
    Initially I had no idea about the problems of comparing when a value was null, hence the need for a function, as I need to compare many fields of rows of a table in order to find what has changed.
    Now, I think I have the NULL check logic in place :
    IF R1.X IS NULL THEN
         IF R2.X IS NULL THEN
              RETURN FALSE; -- both R1 and R2 are null so no diffs
         ELSE
              RETURN TRUE; -- R1 is null but R2 is not, so it's a diff
         END IF;
    ELSE
         IF R2.X IS NULL THEN
              RETURN TRUE; -- R1 is not null but R2 is so a diff
         ELSE
              IF R1.X != R2.X THEN
                   RETURN TRUE; -- both not null but different
              ELSE
                   RETURN FALSE; -- both not null but equal
              END IF;
         END IF;
    END IF;My problem is that I don't know how, or if i can, create function that can simply accept two column values without defining their datatypes in the function sig. Reason being that while I will always be comparing like-for-like datatypes, I won't always be comparing the "same" like-for-like datatypes; so as I loop through 100 table rows (differentiated by a date), I'll physically compare all the fields in the rows one by one, and in one instance i'm comapring two NUMBERs and then two VARCHARs and then two DATEs, etc.
    What i didn't want was duplicate func's that are all the same apart from the sig's.
    Is there an easy(ier) way to accomplish this? Is there a more "generic" value type I could use? basically i just want to have a function like :
    CREATE OR REPLACE FUNCTION(val1 VALUE, val2 VALUE)
    And not multiple like :
    CREATE OR REPLACE FUNCTION(val1 NUMBER, val2 NUMBER)
    CREATE OR REPLACE FUNCTION(val1 DATE, val2 DATE)
    and so on.
    Edited by: user11258962 on 28-Jun-2010 09:02

    You can use function overloading. So, although three function will exist, they will all be called the same name, so your code will always call a single function
    create or replace package pkg_compare as
      function is_Alike (p1 in number
                        ,p2 in number) return boolean ; 
      function is_Alike (p1 in varchar2
                        ,p2 in varchar2) return boolean; 
      function is_Alike (p1 in date
                        ,p2 in date) return boolean; 
    end pkg_Compare;
    create or replace package body pkg_compare as
      function is_Alike (p1 in number
                        ,p2 in number) return boolean as
        begin
          return ( nvl(p1,0) = nvl(p2,-1) );
      end is_Alike;
      function is_Alike (p1 in varchar2
                        ,p2 in varchar2) return boolean as
        begin
          return ( nvl(p1,'X') = nvl(p2,'Z') );
      end is_Alike;
      function is_Alike (p1 in date
                        ,p2 in date) return boolean as
        begin
          return ( nvl(p1,sysdate) = nvl(p2,sysdate-1) );
      end is_Alike;
    end pkg_Compare;
    /

  • How to handle Null value in Database Adapter

    I configured the DA Adapter, with operation type as "Perform an Operation on a Table - Select" and added few where clause parameters (StreetNo, StreetName city, country, state, zipcode)too.
    If we won't enter any value for any of the column in the table (S_ADDR_PER) is taking as NULL, so what happening is, if i give "%" or if i leave as "blank" to those columns(input for where clause parameter). The DB adapter not fetching any records. Any help to handle this situation.
    I need query like this...
    select * from S_ADDR_PER where city like '%' AND state is NULL AND addr_line_2 like '%';
    seems.... I can't use the pure SQL option since i don't know which column will be null. Some case the addr_line_2 column will be NULL in table, in some other case the state or city column will be null.

    Hi,
    you can handle null with date like this , If it doesn't wortk for you then please explain your problem.
    select NVL(to_char(sysdate,'DD-MON-YY'),'Not Recorded')
    from dual
    NVL(TO_CHAR(
    08-NOV-05
    select NVL(to_char(NULL,'DD-MON-YY'),'Not Recorded')
    from dual
    SQL> /
    NVL(TO_CHAR(
    Not Recorded
    Regards

  • Help needed for MySQL 5 database DSN less connection with Oracle reports

    Hi,
    I am using Oracle Develper Suite and java (J2EE) for my application. I am using MySql 5 as database tool. I want to use Oracle reports of Oracle Develper suite. I have created some reports by first creating system DSN for MySql database and then connect Oracle reports to that DSN by "jdbc:odbc" connection string provided in Oracle Report developer wizard. This is working fine.
    I want to generate reports without creating system DSN (DSN less) so that i can use my application on any computer without creating DSN for Oracle Reports. I am deploying my application on OC4j as "EAR" file.
    Help in this regard will be highly appreciated.
    Regards.

    Using an 8i client, you will need to configure the tnsnames.ora file with appropriate connection information if you are using local naming. If you are using host naming or something like an Oracle Names server to resolve TNS aliases, you can skip the tnsnames.ora configuration. A default installation of the Oracle client, though, will probably be using local naming.
    If the tnsnames.ora file is configured, or you have configured an alternate way of resolving TNS aliases, you should be able to use the connection string
    DRIVER={Oracle ODBC Driver};DBQ=<<TNS alias>>;UID=system;PWD=managerIf you wanted to move to the 10g client (the 10g Instant Client could be useful here), there are some streamlined naming methods that could be used instead of configuring the tnsnames.ora file.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Value "null" is displayed when retrieving null values from database

    Hi,
    I'm retrieving a record from Oracle database using a ResultSet rs and displaying the values on screen. Some of the columns do not have any data.
    The statements are:
    ResultSet rs
    st=con.createStatement();
    rs=st.executeQuery(............)
    out.println("<input name='punch_line' type='text' value='"+rs.getString(7)+"'>");
    The problem is that there is no value in the database column rs.getString(7). Ideally when the value is null, the field should not display anything. But in my case it is displaying the text "null".
    Can anyone let me know how can I display a blank value instead of displaying the text "null"?
    Thanks,
    Sridhar

    api >
    String getString(int columnIndex)
    Gets the value of the designated column in
    column in the current row of this ResultSet object as
    a String in the Java programming language.
    so null is returned as string object..NO.
    http://java.sun.com/j2se/1.5.0/docs/api/java/sql/ResultSet.html
    Returns:
    the column value; if the value is SQL NULL, the value returned is null
    The Java literal null is returned, not the String "null". The JDBC API provides a method wasNull() to detect if the previous accessed column returned a SQL NULL.

  • Help needed in opening AW database in Excel

    My wife has a massive AW database doc that needs to go to Excel for Windows but it does not seem to be working to make the move.  I saved it as an ASCII doc but it did not work.  Is this supposed to work?  Also, if I buy Excel for Mac, will this do any good?  Thanks.

    Yes, exporting as ASCII should work; the resultant file is tab-separated values and Excel may be set to look for comma-separated values: there may be a setting to change this when you import. Also you might need to change the extension from .txt to something else (.tab for example): this is something you would have to check in Excel's documentation.

  • Help needed: Read-only network database for PDFs

    I am a relative beginner when it comes to using pdfs.
    I am looking to set up a network with a database of pdf files on a central server which can be accessed (read-only) from the terminal pcs on the network.
    Can anyone suggest a simple way to build a database and go about this?
    Many thanks in advance.
    Murray

    It's just a normal web site but on your local network. You can use a
    local search engine or a Google Appliance. Your web administrator, if
    you have one, may have the expertise, or there may already be one.
    Aandi Inston

  • How to Replace Null Value as 0 in an OBIEE11g Pivot Table? it's working 10g

    Hi,
    How to Replace Null Value as 0 in an OBIEE11g Pivot Table? it's working in obiee10g version.
    We have tried below methods
    1) criteria tab and edit the ‘column properties’ associated with your fact measure. Choose the ‘Data Format’ tab, tick to override the default format and choose ‘Custom’.
    It seems that the syntax for this custom format is positive-value-mask (semi colon) negative-value-mask (semi colon) null-mask. So this means we have a few options.
    E.g. if you want zeros (0) instead of null then enter:
    #,##0;-#,##0;0
    2) in that formula columns we have put it below case condition also ,
    Measure Column: Nom_amt --> edit formulas
    CASE WHEN Nom_amt IS NULL THEN 0 ELSE Nom_amt END
    3) we have uncheked IS NULL check box in the admin tool also
    I tried above formats still it's not working for me..kindly help me on this..
    thanks to do the needfull
    Best Regards,
    R.Devarasu

    Hi,
    Null value in database displaying as 0 in report, I need to keep value as in database, and I have one calculated row which is based on null values should also null in report.
    but it showing 0 for null values also so, my calculated row showing wrong result.
    my report is like
    col1 col2
    ABC 0
    BCD 12
    DEF -12 --this is calculated row.
    I require result like:
    col1 col2
    ABC null
    BCD 12
    DEF null --this is calculated row.
    Please let me know how I can achieve this.
    Thanks,
    Rahul

  • JDBC Receiver Adapter with Null Value

    HI,
    I have configured ID for JDBC Receiver. In my communication channel, I already check Integration of Empty String Values = Null Value. However, when I check the result from audit log, it still shows that SAP XI sends the null value to database. In my understanding, it should not send the field which has null value (It shouldn't be included in sql statement).
    I check this with other scenario. With the same check at Integration of Empty String Values = Null Value, it doesn't send null value to database. It happens only with my first scenario.
    Have anyone ever been through this before? Any suggestion please?
    Thanks,
    Pavin

    Hi,
    1. The occurrence is 0...1
    2. This is the first result with null value (Please see field Error)
    UPDATE EXPCRM_T_CustomerProfile SET RequestID=455, RecordNo=1, SAPCustomerCode=0001000344, Error=NULL, Status=2, UpdateDateTime=12/03/2008 13:45:03 WHERE (RequestID=455 AND RecordNo=1)
    Then, I change the option from Null Value to Empty string. This is the result.
    UPDATE EXPCRM_T_CustomerProfile SET RequestID=455, RecordNo=1, SAPCustomerCode=0001000344, Error=', Status=2, UpdateDateTime=12/03/2008 13:46:12 WHERE (RequestID=455 AND RecordNo=1)
    Field Error Change from NULL to '
    The expected result from me is that field Error should not exist at all. Please help.
    Thanks,
    Pavin

  • Need help Take out the null values from the ResultSet and Create a XML file

    hi,
    I wrote something which connects to Database and gets the ResultSet. From that ResultSet I am creating
    a XML file. IN my program these are the main two classes Frame1 and ResultSetToXML. ResultSetToXML which
    takes ResultSet & Boolean value in its constructor. I am passing the ResultSet and Boolean value
    from Frame1 class. I am passing the boolean value to get the null values from the ResultSet and then add those
    null values to XML File. When i run the program it works alright and adds the null and not null values to
    the file. But when i pass the boolean value to take out the null values it would not take it out and adds
    the null and not null values.
    Please look at the code i am posing. I am showing step by step where its not adding the null values.
    Any help is always appreciated.
    Thanks in advance.
    ============================================================================
    Frame1 Class
    ============
    public class Frame1 extends JFrame{
    private JPanel contentPane;
    private XQuery xQuery1 = new XQuery();
    private XYLayout xYLayout1 = new XYLayout();
    public Document doc;
    private JButton jButton2 = new JButton();
    private Connection con;
    private Statement stmt;
    private ResultSetToXML rstx;
    //Construct the frame
    public Frame1() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    //Component initialization
    private void jbInit() throws Exception {
    //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]")));
    contentPane = (JPanel) this.getContentPane();
    xQuery1.setSql("");
    xQuery1.setUrl("jdbc:odbc:SCANODBC");
    xQuery1.setUserName("SYSDBA");
    xQuery1.setPassword("masterkey");
    xQuery1.setDriver("sun.jdbc.odbc.JdbcOdbcDriver");
    contentPane.setLayout(xYLayout1);
    this.setSize(new Dimension(400, 300));
    this.setTitle("Frame Title");
    xQuery1.setSql("Select * from Pinfo where pid=2 or pid=4");
    jButton2.setText("Get XML from DB");
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch(java.lang.ClassNotFoundException ex) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(ex.getMessage());
    try {
    con = DriverManager.getConnection("jdbc:odbc:SCANODBC","SYSDBA", "masterkey");
    stmt = con.createStatement();
    catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    jButton2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    jButton2_actionPerformed(e);
    contentPane.add(jButton2, new XYConstraints(126, 113, -1, -1));
    //Overridden so we can exit when window is closed
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
    System.exit(0);
    void jButton2_actionPerformed(ActionEvent e) {
    try{
    OutputStream out;
    XMLOutputter outputter;
    Element root;
    org.jdom.Document doc;
    root = new Element("PINFO");
    String query = "SELECT * FROM PINFO WHERE PID=2 OR PID=4";
    ResultSet rs = stmt.executeQuery(query);
    /*===========This is where i am passing the ResultSet and boolean=======
    ===========value to either add the null or not null values in the file======*/
    rstx = new ResultSetToXML(rs,true);
    } //end of try
    catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    ======================================================================================
    ResultSetToXML class
    ====================
    public class ResultSetToXML {
    private OutputStream out;
    private Element root;
    private XMLOutputter outputter;
    private Document doc;
    // Constructor
    public ResultSetToXML(ResultSet rs, boolean checkifnull){
    try{
    String tagname="";
    String tagvalue="";
    root = new Element("pinfo");
    while (rs.next()){
    Element users = new Element("Record");
    for(int i=1;i<=rs.getMetaData().getColumnCount(); ++i){
    tagname= rs.getMetaData().getColumnName(i);
    tagvalue=rs.getString(i);
    System.out.println(tagname);
    System.out.println(tagvalue);
    /*============if the boolean value is false it adds the null and not
    null value to the file =====================*/
    /*============else it checks if the value is null or the length is
    less than 0 and does the else clause in the if(checkifnull)===*/
    if(checkifnull){ 
    if((tagvalue == null) || tagvalue.length() < 0 ){
    users.addContent((new Element(tagname).setText(tagvalue)));
    else{
    users.addContent((new Element(tagname).setText(tagvalue)));
    else{
    users.addContent((new Element(tagname).setText(tagvalue)));
    root.addContent(users);
    out=new FileOutputStream("c:/XMLFile.xml");
    doc = new Document(root);
    outputter = new XMLOutputter();
    outputter.output(doc,out);
    catch(IOException ioe){
    System.out.println(ioe);
    catch(SQLException sqle){

    Can someone please help me with this problem
    Thanks.

  • Urgent help needed; Database shutdown issues.

    Urgent help needed; Database shutdown issues.
    Hi all,
    I am trying to shutdown my SAP database and am facing the issues below, can someone please suggest how I can go about resolving this issue and restart the database?
    SQL> shutdown immediate
    ORA-24324: service handle not initialized
    ORA-24323: value not allowed
    ORA-01089: immediate shutdown in progress - no operations are permitted
    SQL> shutdown abort
    ORA-01031: insufficient privileges
    Thanks and regards,
    Iqbal

    Hi,
    check SAP Note 700548 - FAQ: Oracle authorizations
    also check Note 834917 - Oracle Database 10g: New database role SAPCONN
    regards,
    kaushal

Maybe you are looking for

  • Getting error message when trying to burn cd's

    hi i am getting a error message when trying to put certain cd's on i-tunes : Microsoft Windows XP Professional Service Pack 2 (Build 2600) VIA Technologies, Inc. VT8366A-8233 iTunes 7.5.0.20 CD Driver 2.0.6.1 CD Driver DLL 2.0.6.2 Current user is an

  • Regarding Screen Exits

    Hi all, In tcode XD02 i want to add 3 fields (account no. , Branch and Bank Details)..In Standard Screen. What is Screen Exit For the XDO2? Can Any One Tell the Step by step process to create Screen Exits. How To work with  Tcodes CMOD And SMOD?

  • Canvas becomes too big when generating tabs on a content canvas

    I want to generate the following layout: <New content canvas> block 1 height 15 width 80 prompt: field prompt: field <New tab canvas page> tab 1 height 31 width 80 Multirecord block which is a detail of block 1 <New tab canvas page> tab 2 height 31 w

  • KeyCode always zero

    Hi all. I'm trying to get my JTextField to transfer focus when the user hits enter. However, for some reason, I always get zero when I call keyEvent.getKeyCode(). The weird thing is, the getKeyChar() shows the correct character. Something funky is go

  • Why does AttachMovie not work after a loadClip?

    Hi, i am trying to attach a movieclip from my library to the movieclip that is loaded. It does not seem to work. I only can attach it to the _root! In this example i have an movieclip with an idintifier link of 'round'. As you can see i can approach