Having problem querying data from database

I'm trying to setup a query form to see if the username and password entered is already in a database. If it is then a Static Text will give a positive message, if not then the user would be asked to register. My query doesn't seem to work, since every time I run it the Static Text doesn't show anything after I hit my submit button. Any help would be great.
public String loginButton_action() {
// TODO: Process the action. Return value is a navigation
// case name where null will return to the same page.
String currentuser = (String) regusernameTF.getValue();
String currentpass = (String) regpasswordTF.getValue();
try {
connection = DriverManager.getConnection(Database_URL);
statement = connection.createStatement();
ResultSet resultset = statement.executeQuery(
"SELECT Username ,Password FROM CustomerInfo" +
"WHERE (Username =' " currentuser " ') ");
connection.commit();
statement.close();
connection.close();
String loggeduser = resultset.getString(1);
String loggedpass = resultset.getString(2);
boolean compare1 = loggeduser.equals(currentuser);
boolean compare2 = loggedpass.equals(currentpass);
if ((compare1==true) || (compare2==true)){
messageST.setRendered(true);
messageST.setText("Login Successful");
else {
messageST.setRendered(true);
messageST.setText("Username & Password not Valid." +
"Please Check Entry or Register to Login");
catch (Exception e){
e.printStackTrace();
return null;
Edited by: mavrik5150 on Feb 9, 2008 4:49 PM
Edit: Forgot to mention the Database does have data already populated into it

Hey Thanks guys for the tips, I was able to fix one problem, now I can get the Static Text field to display a message but I can't get the error message to appear when I purposly enter a wrong password or username. If I enter a correct username I get a successful message, even when I enter the wrong password. Here's the fixed code:
    public String loginButton_action() {
        // TODO: Process the action. Return value is a navigation
        // case name where null will return to the same page.
        Object currentuser =  regusernameTF.getValue();
        Object currentpass =  regpasswordTF.getValue();
        try {
        connection = DriverManager.getConnection(Database_URL);
        statement = connection.createStatement();       
        ResultSet resultset = statement.executeQuery(
                "SELECT Username ,Password FROM CustomerInfo WHERE (Username ='"+currentuser+"') ");       
//        connection.commit();
//        statement.close();
//        connection.close();   
        while (resultset.next()){
        String loggeduser = resultset.getString("username");
        String loggedpass = resultset.getString("password");
        boolean compare1 = loggeduser.equals(currentuser);
        boolean compare2 = loggedpass.equals(currentpass);
        if (compare1 || compare2){
            messageST.setRendered(true);
            messageST.setText("Login Successful");
        else {
            messageST.setRendered(true);
            messageST.setText("Username & Password not Valid." +
                    "Please Check Entry or Register to Login");
        catch (Exception e){
            e.printStackTrace();
        return null;
    }

Similar Messages

  • Best Practice on querying Data from Database

    Hello and I was wondering what is the preferred and best practice for querying data from an SQL database inside a JSP page. Is it using the JSTL library or another method? Thanks

    It depends on the size of the application really.
    The "correct and preferred" approach in a large MVC app would be to have a seperate class that does all the database access, retrieving the data into java objects.
    Check out [url http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html] DAO pattern
    You then "save" the data into request/session attributes, and forward to a jsp page to render the result.
    Most approaches recommend a separation between JSP (the view) and SQL code.
    The JSTL sql tags are provided more for "quick and dirty" code applicable in small applications, or for fast prototyping. That approach is not really robust for large scale applications.
    Cheers,
    evnafets

  • Query Data From Database and set Visibility Accordingly

    Hi there,
    i have a case where i have to set the rendered property of some items on my screen according to values retrieved from an sql statement.
    When i change a value in a listbox, that value must be given to an sql statement as a parameter (select field_id fom table where id = the value in the list box) to query the ids of the fields from a database table . (each id of a field in my jsf page has the same value in that database table).
    For each record retrieved in that query, the field's rendering having that id must turn to false.
    Anyone can give me a solution to my urgent problem ? ( Where do i write the select statement and the loop and how ... )

    Hi,
    what comes to my mind is to create a custom version of HashMap (extend HashMap) and override the get method. The configure this custom Hashmap as a managed bean. Usually you cannot pass arguments in EL, but for HashMaps this is doable by overriding the get method (at least I remember having done this before).
    So in your EL rendered property value you do
    #{managedHashMapBean["nameOfFieldId"]
    In the bean you just check if the ID exists and if it doesn't return true. So all that your query needs to do is to populate the internal state of the hashmap with the IDs that should be false.
    Frank

  • How to query data from database and store it into Managed Bean ?

    Hi all,
    In our application we have requirement to store information within Managed Bean to be accessed by ADF pages.
    The information is stored in database tables.
    The question is :
    What is the efficient / recommended way to do that ?
    I do not use apps module to query the data because the information is required in View layer not the model layer
    Thank you for your help,
    xtanto

    Xtanto,
    if the information is stored in the database then the question is if there is a database connect open already. If yes, then why not using this connection to query for the data you want to access and store. Alternatively you can directly open a JDBC connection in a managed bean or access an EJB session bean. However, this comes with the price of an extra database connection.
    Make sure the managed bean is in session scope if you want to share the information without re-fetching it
    Frank

  • Problem reading data from database

    Hi All,
    I'm doing some test with Oracle Coherence, particulary testing partitioned cache of a database. I'm using a client/server archictecture and I developed my own CacheStore. So, the problem is, after start the server and the client, when i do a get() in the client for a object that is on database and not in the cache, the cache answer is it doesn't exist. Isn't it supposed the cache "call" the cache store and read/verify if it is on database?
    My Configuration file:
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
    <caching-scheme-mapping>
    <cache-mapping>
    <cache-name>Recharge</cache-name>
    <scheme-name>partitioned-cache</scheme-name>
    </cache-mapping>
    </caching-scheme-mapping>
    <caching-schemes>
    <distributed-scheme>
    <scheme-name>partitioned-cache</scheme-name>
    <backing-map-scheme>
    <read-write-backing-map-scheme>
    <write-delay>0</write-delay>
    <read-only>false</read-only>
    <internal-cache-scheme>
    <local-scheme>
    <scheme-name>InMemoryScheme</scheme-name>
    </local-scheme>
    </internal-cache-scheme>
    <cachestore-scheme>
    <class-scheme>
    <class-name>RechargeCacheStore</class-name>
    </class-scheme>
    </cachestore-scheme>
    </read-write-backing-map-scheme>
    </backing-map-scheme>
    <listener/>
    <autostart>true</autostart>
    </distributed-scheme>
    </caching-schemes>
    </cache-config>
    Tanks,
    Paulo Sousa

    Hi Paolo,
    You should use a fully qualified class name to enable the JVM class loader to find the RechargeCacheStore class.
    Regards,
    Harv

  • Problems transferring data from MacBook Pro to MacBook Pro

    I just bought a new MacBook Pro and I am having problems transferring data from my old MacBook Pro. I am using an Apple Thunderbolt to FW adapter to hook both computers and I am using the Migration Assistant. Everything looked ok until the "Transferring Your Information" screen got stuck. It says that it is "Transferring your Application folder..." And it has been stuck for at least the last two hours giving a message that says "About 3 minutes remaining..." This is starting to get ridiculously annoying. Options?

    I guess I am finding my own way as time progresses and frustration increases but these are two things that I have found so far:
    1. Transfering from one machine to another does not seem to be the most efficient way to do this so using the TimeMachine backup must be the way to go...
    HOWEVER
    2. In this process I also found another "complication" called: Legacy FaultVault - My computer is encripted and I used this now so called "Legacy FaultVault" app to do it (when it was no a Legacy!). The thing is that you can not transfer documents from your TimeMachine backup to your new Mac if the Legacy Fault Valut is active on your old machine so you first need to desactivate the encription. HOWEVER, this brought another issue...when I tried to desactivate the encription using the Legacy FaultVault screen I got a message saying that I did not have enough disk space to allow me to do that....Isn't that great??? This is a problem by itself and it seems to have some sort of solution I was reading about (not straight forward at all). What I am trying to do now is to copy the folder that contains my files and just paste them on my new machine to see if that works....it looks like my apps are on my new machine, unsure if they are working...need to test this next....
    I guess the transfer machine to machine could have sorted out the conflict eventually...after tens of hours or maybe not! Who knows....
    A very frustrated Apple fan...
    I love Apple products but this is an ISSUE...I feel like there is lack of adecuate documentation around to deal with this or the data transfering apps should be able to deal with this on a more efficient way....just saying...

  • Migration Assistant: Problems transferring data from PC (XP SP3) to new Mac Pro 2012 - can not get Migration Assistant to work as PC will not display verfify passcode

    Migration Assistant: Problems transferring data from PC (XP SP3) to new Mac Pro 2012 - can not get Migration Assistant to work as PC will not display verfify passcode
    Hello, I am having problems migrating data from my old PC running XP (SP3) to my new Mac Pro 2012 using the Migration Assistant.
    - I downloaded and installed the Windows Migration Assistant from Apple
    - My Mac recognized PC and displays passcode
    - The sasscode does not show / display on my PC
    - My Mac is then stuck in "authenticating" loop and the PC is stuck "waiting for Mac to connect."
    - Both computers are connected on same network (have connected PC on WIFI and using ethernet to Reuter)
    I have looked on support site and only response I saw says to reinstall Windows Migration Assistant (which I have done)
    Any ideas?  If cant get this to workare there instructions for manually bring across relevant data eg itunes music and apps, photos, picasa data etc?

    Why not turn off the Windows firewall and uninstall any other firewall software you have installed?
    If you are using a Norton product uninstall it and discard it. To fully unistall most Norton products you have to go to the Norton website and download a soecial program to completely get rid of it. The normal uninstall feature built into the program will not remove all of it.

  • Swing Applet in JSP: problem with fetching data from database

    i am facing a problem while fetching data from database using Swing Applet plugged in a JSP page.
    // necessary import statements
    public class NewJApplet extends javax.swing.JApplet {
    private JLabel jlblNewTitle;
    private Vector vec;
    public static void main(String[] args) {
    JFrame frame = new JFrame();
    NewJApplet inst = new NewJApplet();
    frame.getContentPane().add(inst);
    ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
    frame.pack();
    frame.setVisible(true);
    public NewJApplet() {
    super();
    initGUI();
    private void initGUI() {
    try {
    this.setSize(542, 701);
    this.getContentPane().setLayout(null);
    jlblTitle = new JLabel();
    this.getContentPane().add(jlblTitle);
    jlblTitle.setText("TITLE");
    jlblTitle.setBounds(197, 16, 117, 30);
    jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
    jlblNewTitle = new JLabel();
    this.getContentPane().add(jlblNewTitle);
    Vector vecTemp = getDBDatum(); // data fetched fm DB r stored here.
    jlblNewTitle.setText(vecTemp.get(1).toString());
    jlblNewTitle.setBounds(350, 16, 117, 30);
    jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));
    } catch (Exception e) {
    e.printStackTrace();
    }//end of initGUI()
    private Vector getDBDatum() {
    // fetches datum from oracle database and stores it in a vector
    return lvecData;
    }//end of getDBDatum()
    }//end of class
    in index.jsp page i have included the following code for calling this applet:
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
    width="600" height="300">
    <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>
    if i view it in using AppletViewer it runs perfectly and display the data in JLabel. (ie, both jlblTitle and jlblNewTitle).(ie, DATA FETCHES FROM db AND DISPLAYS PROPERLY)
    BUT IF I CLICK ON INDEX.JSP, ONLY jlblTitle APPEARS. jlblnNewTitle WILL BE BLANK(this label name is supposed to fetch from database)
    EVERY THING IS DISPAYING PROPERLY EXCEPT DATA FROM DATABASE!!!
    i signed the applet as follows :
    grant {
    permission java.security.AllPermission;
    Can any body help me to figure out the problem?

    This is the Swing Applet java code
    import java.awt.Dimension;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Vector;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.JScrollPane;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTree;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.SwingConstants;
    public class HaiApplet extends javax.swing.JApplet {
         private JLabel     jlblTitle;
         private JLabel     jlblNewTitle;
         private Vector     vec;
         * main method to display this
         * JApplet inside a new JFrame.
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              NewJApplet inst = new NewJApplet();
              frame.getContentPane().add(inst);
              ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
              frame.pack();
              frame.setVisible(true);
         public HaiApplet() {
              super();
              initGUI();
         private void initGUI() {
              try {               
                   this.setSize(542, 701);
                   this.getContentPane().setLayout(null);
                        jlblTitle = new JLabel();
                        this.getContentPane().add(jlblTitle);
                        jlblTitle.setText("OMMS");
                        jlblTitle.setBounds(197, 16, 117, 30);
                        jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
                        jlblTitle.setHorizontalAlignment(SwingConstants.CENTER);
                        jlblTitle.setForeground(new java.awt.Color(0,128,192));
                        jlblNewTitle = new JLabel();
                        this.getContentPane().add(jlblNewTitle);
                        Vector vecTemp = getDBDatum();
                        jlblNewTitle.setText(vecTemp.get(1).toString());
                        jlblNewTitle.setBounds(350, 16, 117, 30);
                        jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));     
              } catch (Exception e) {
                   e.printStackTrace();
         }//end of initGUI()
         private Vector getDBDatum() {
              Vector lvecData = new Vector(10,5);
              Connection lcon = null;
              Statement lstmt = null;
              ResultSet lrsResults = null;
              String lstrSQL = null;
              String lstrOut = null;
              try {
                   OmmsDBConnect db = new OmmsDBConnect();
                   lcon = db.connectDb();
                   lstmt = lcon.createStatement(lrsResults.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                   lstrSQL = "select DT_ID from P_DATATABLES";
                   lrsResults = lstmt.executeQuery(lstrSQL);        
                   int i = 0;
                   lrsResults.last();
                   int length = lrsResults.getRow();
                   System.out.println(length);
                   lrsResults.beforeFirst();
                   int recCount = 0;
                   while (lrsResults.next()) {
                        recCount++;
                        lvecData.addElement(new String(lrsResults.getString("DT_ID")));
                   //     System.out.println("ID :  " + lrsResults.getString(1));
                        i++;
                   }System.out.println("here 3 out fm while");
              catch(SQLException e) {
                   System.out.print("SQLException: ");
                   System.out.println(e.getMessage());
              catch(Exception ex) {
                   lstrOut = "Exception Occured " + ex.getMessage();
              finally {
                   try {
                        lrsResults.close();
                        lstmt.close();
                        lcon.close();
                        System.out.println("[DONE]");
                   catch(Exception e) {
                        System.out.println(e);
             }//end of finally
              return lvecData;
         }//end of getDBDatum()
    }//end of classOfcourse the above code compiles and runs well. in Applet Viewer
    I plugged the above Swing Applet in a JSP page index.jsp
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
                   width="600" height="300">
         <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>Every thing is working fine in AppletViewer...But if i view this in any browser, then only the jlblTitle is displaying. jlblNewTitle is not displaying(this label name is actually fetching from thedatabase)
    can any body help me regarding this matter.? Thx in Advance.

  • Problem in populating jtable data from database

    hi,
    i am using JTable to retrieve data from database and show it in table. JTable
    is working fine with static data. but while retrieving from databse its giving a NullPointerException at getColumnClass() method. Below is complete source code. plzz help.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.sql.*;
    import javax.swing.table.*;
    /*jdbc connection class*/
    class connect
    Connection con;
    Statement stat;
    public connect()throws Exception
    Class.forName("org.postgresql.Driver");
    con=DriverManager.getConnection("jdbc:postgresql://localhost/dl","dl","dl");
    stat=con.createStatement();
    public ResultSet rsf(String rsstr)throws Exception
    ResultSet rs=stat.executeQuery(rsstr);
    return rs;
    public void upf(String upstr)throws Exception
    stat.executeUpdate(upstr);
    class MyTableModel extends AbstractTableModel
    private String[] columnNames = {"name","id","dep","cat","rem","chkout"};
    Object[][] data;
    public MyTableModel()
    try{
    connect conn=new connect();
    ResultSet rs3=conn.rsf("select * from usertab");
    ResultSetMetaData rsmd=rs3.getMetaData();
    int col=rsmd.getColumnCount();
    int cou=0;while(rs3.next()){cou++;}
    data=new Object[cou][col];
    System.out.println(cou+" "+col);
    ResultSet rs2=conn.rsf("select * from usertab");
    int i=0;int j=0;
    for(i=0;i<cou;i++)
    rs2.next();
    for(j=0;j<col;j++)
    data[i][j]=rs2.getString(getColumnName(j));
    System.out.println(data[0][2]);
    }catch(Exception e){System.out.println("DFD "+e);}
            public int getColumnCount() {
                return columnNames.length;
            public int getRowCount() {
                return data.length;
            public String getColumnName(int col) {
                return columnNames[col];
            public Object getValueAt(int row, int col) {
                return data[row][col];
           public Class getColumnClass(int c) {
              return getValueAt(0, c).getClass();
            public boolean isCellEditable(int row, int col) {
                if (col < 2) {
                    return false;
                } else {
                    return true;
            public void setValueAt(Object value, int row, int col) {
                data[row][col] = value;
                fireTableCellUpdated(row, col);
    class MyFrame extends JFrame
    public MyFrame()
         setSize(600,500);
         JPanel p1=new JPanel();
         p1.setBackground(new Color(198,232,189));
         JTable table = new JTable(new MyTableModel());
         table.setPreferredScrollableViewportSize(new Dimension(500,200));
         table.setBackground(new Color(198,232,189));
         JScrollPane scrollPane = new JScrollPane(table);
         scrollPane.setBackground(new Color(198,232,189));
         p1.add(scrollPane);
         getContentPane().add(p1);
    /*Main Class*/
    class test2
         public static void main(String args[])
         MyFrame fr =new MyFrame();
         fr.setVisible(true);
    }thanx

    hi nickelb,
    i had returned Object.class in the getColumnClass() method. But then i
    got NullPointerException at getRowCount() method. i could understand that the
    main problem is in data[][] object. In all the methods its returning null values as it is so declared outside the construtor. But if i declare the object inside the constructor, then the methods could not recognize the object. it seems i cant do the either ways. hope u understood the problem.
    thanx

  • Query Data from other Oracle Database into current

    Hi all,
    I have to query data from another oracle database into the current oracle database. Because the customer has standard edition, I cannot use a pipe. I tried "SELECT column_name FROM external_oracle_db.schema.table WHERE column_name = 'column_value';" Unfortunately this does not work.
    Does anyone have a suggestion?
    Thanks
    Hans

    Have you tried with Database links?
    SELECT column_name FROM schema.table@external_oracle_db WHERE column_name = 'column_value';
    Satish

  • Problem with displaying the data from Database on swf file.

    Hi ,
      I am new to flash.Thanks in Advance Please help me....
    Actually my requirement is my application consists a button(submit_Btn) when we click on the button(submit_Btn), each time it must to database(through servlet) and brings the data from database and places it on the flash swf file.Here my problem is for the first time when we click on the button it goes to database and place the data(which was returned from database) on the swf file.Next  when we click on the button for the second time(or anytime) it is not going  and bringing the new data from database(if some data is modified in database or not),Infact it is showing the old data(the data that was collected from previous ClickListener) only on the swf file and it is also not showing any complile time or run time error.
    my Code looks like this:
    submit_Btn.addEventListener(MouseEvent.CLICK,onCheck2);
    function onCheck2(evnt:MouseEvent):void {
    var xmlLoader:URLLoader = new URLLoader();
        var xmlurl:String = "http://localhost:8888/xmlServlet";
        var xmlrequest:URLRequest = new URLRequest(xmlurl);
    xmlLoader.dataFormat = URLLoaderDataFormat.TEXT;
    xmlLoader.addEventListener(Event.COMPLETE, xmlcompleteHandler);
    xmlLoader.load(xmlrequest);
    function xmlcompleteHandler(event:Event):void {
        var loader:URLLoader = URLLoader(event.target);
        var succData:String=loader.data;
            var xmlData:XML = new XML();
            var xmlList:XMLList;
            xmlData = XML(loader.data);
            xmlList = xmlData.children();
            for (var i=0; i<xmlList.length(); i++) {
                for (var n=0; n<xmlData.UserHumanap[i].HumanapDot.length(); n++) {
                        var x_coordinate:Number = xmlData.UserHumanap[i].HumanapDot[n].@x;
                        var y_coordinate:Number = xmlData.UserHumanap[i].HumanapDot[n].@y;
                        var point2:Point = new Point(x_coordinate,y_coordinate);
                        var circle:Sprite = new Sprite();
                        circle.graphics.beginFill(0x00ff00);
                        circle.graphics.drawCircle(point2.x,point2.y,3);   //Placing the data as dots on the swf file
    Thanks in Advance.......Please Help me..........
    its Urgent..........
    Thanks,
    Swarthi

    Checkout following line in your code
    var xmlurl:String = "http://localhost:8888/xmlServlet";
    now change it to
    var xmlurl:String = "http://localhost:8888/xmlServlet?random="+String(MAth.random());
    I think you will get the point now

  • Problem reading data from oracle database 11g using OleDbDataReader

    Hi everyone I work with Visual Studio 2010 and C# programming language. I have a problem reading data from the oracle database. I created a WPF application with my main Window Xaml and class files and 1 more class called DataFiles. The thing I want is to read some data from the database on my grid in my WPF window. Problem is even though it connects to the database the grid is always empty. It isn't the connection string as I tested it and it connects to the database the problem seems to be in showing the LASTNAME (PREZIME in my native tongue) on the grid which is what it's supposed to do.
    Here is the code:
    Data Files Code
    using System;
    using System.Collections.ObjectModel;
    using System.Data.SqlClient;
    using System.Data.OleDb;
    namespace SQLKonekcija
        public class clsEmployee
            public string Prezime { get; set; }
        public class DataAccess
            OleDbConnection oleCon;
            OleDbCommand oleComd;
            public DataAccess()
                string connectionString = "provider=ORAOLEDB.ORACLE; data source=ORCL; password=****; user id=****;";
                oleCon = new OleDbConnection(connectionString);
            public ObservableCollection<clsEmployee> GetAllEmployee()
                ObservableCollection<clsEmployee> EmpCol = new ObservableCollection<clsEmployee>();
                oleComd = new OleDbCommand();
                oleComd.Connection = oleCon;
                oleComd.CommandText = "Select PREZIME from UPOSLENICI";
                oleCon.Open();
                OleDbDataReader Reader = oleComd.ExecuteReader();
                Reader.Read();
                while (Reader.Read())
                    EmpCol.Add(new clsEmployee()
                        Prezime = Reader["PREZIME"].ToString()
                oleCon.Close();
                return EmpCol;
            }And here is my main window.cs code
    public partial class MainWindow : Window
            clsEmployee objEmpToAdd;
            DataAccess objDs;
            public MainWindow()
                InitializeComponent();
            private void Window_Loaded(object sender, RoutedEventArgs e)
                objDs = new DataAccess();
                dgEmp.ItemsSource = objDs.GetAllEmployee();And the XAML
    <Window x:Class="SQLKonekcija.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
        <Grid>
            <DataGrid AutoGenerateColumns="False" Height="237"
                      HorizontalAlignment="Left" Margin="18,66,0,0" Name="dgEmp"
                      VerticalAlignment="Top" Width="466" ColumnWidth="*"
                       >
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding PREZIME}" Header="Prezime"></DataGridTextColumn>
                </DataGrid.Columns>
            </DataGrid>
            <TextBlock Height="42" HorizontalAlignment="Left" Margin="18,15,0,0" Name="textBlock1" Text="TEST CONNECTION" VerticalAlignment="Top" Width="462" TextAlignment="Center" FontSize="28" FontWeight="ExtraBold" />
        </Grid>
    </Window>
    The guys on the MSDN forums told me I should ask the question here so sorry if it's not your field.
    Hope u guys can help, thanks.

    I tried it, commented out the reader.read and have the following connection string
    string connectionString = "provider=ORAOLEDB.ORACLE; data source=ORCL; password=****; user id=****; OLEDB.NET=True"
    Unfortunately the result is the same.
    Edited by: Dino2dy on Nov 24, 2011 12:53 AM

  • Problem in printing the data from database when i print inside servlet

    hi to all!
    the objective of the code below is getting the data from database table and has to send that data to the web browser using out.println .note: out - PrintWriter object
    In a getQuestion method, i am getting the data from database table and store it in String q and when i print the q within this method it is getting printed, but i got the null value when i printed the String q inside service method doPost. why..? its puzzling me.
    package servlet;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class test extends HttpServlet {
         Connection con;
         ResultSet rs;
         Statement s;
         StringBuffer q;
         StringBuffer o1;
         StringBuffer o2;
         StringBuffer o3;
         public void getQuestion() throws Exception
              if(rs.next())
                   q=new StringBuffer(rs.getString("question"));
                   o1=new StringBuffer(rs.getString("option1"));
                   o2=new StringBuffer(rs.getString("option2"));
                   o3=new StringBuffer(rs.getString("option3"));
                   System.out.println(q);
                   System.out.println(o1);
                   System.out.println(o2);
                   System.out.println(o3);
         public void connect(){
              try
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              con=DriverManager.getConnection("jdbc:odbc:ds","sa","server");
              s=con.createStatement();
              rs=s.executeQuery("select * from qa order by newid()");
              getQuestion();
              catch(Exception e)
                   System.out.println("erroe");
         public void doPost(HttpServletRequest request,HttpServletResponse response)
         throws IOException,ServletException
              response.setContentType("text/html");
              new test().connect();
              PrintWriter out=response.getWriter();
              request.setAttribute("question", q);
              request.setAttribute("option1", o1);
              request.setAttribute("option2", o2);
              request.setAttribute("option3", o3);
              //RequestDispatcher rd=getServletContext().getRequestDispatcher("/show.jsp");
              //rd.forward(request, response);
              out.println("<html>");
    out.println("<head>");
         out.println("<title>" + "shock!!!" + "</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h2>"+"Read twice before u answer"+"<h2>");
    out.println("<p></p>");
    //why the value of q is not getting printed, instead i get null
    out.println("<h2>"+ q +"<h2>");
    out.println("how is it");
    out.println("</body>");
    out.println("</html>");
    Edited by: Mahesh_yeswecan on Nov 29, 2008 10:42 AM

    As u said , i have done a silly mistake earlier. though i have corrected the code still i am getting the same null value
    package servlet;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class test extends HttpServlet  {
         Connection con;
         ResultSet rs;
         Statement s;
         StringBuffer q;
         StringBuffer o1;
         StringBuffer o2;
         StringBuffer o3;
         public void getQuestion() throws Exception
              if(rs.next())
                   q=new StringBuffer(rs.getString("question"));
                   o1=new StringBuffer(rs.getString("option1"));
                   o2=new StringBuffer(rs.getString("option2"));
                   o3=new StringBuffer(rs.getString("option3"));
                   System.out.println(q);
                   System.out.println(o1);
                   System.out.println(o2);
                   System.out.println(o3);
         public void connect(){
              try
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              con=DriverManager.getConnection("jdbc:odbc:ds","sa","server");
              s=con.createStatement();
              rs=s.executeQuery("select * from qa order by newid()");
              getQuestion();
              catch(Exception e)
                   System.out.println("erroe");
         public void doPost(HttpServletRequest request,HttpServletResponse response)
         throws IOException,ServletException
              response.setContentType("text/html");
              connect();
              PrintWriter out=response.getWriter();
              request.setAttribute("question", q);
              request.setAttribute("option1", o1);
              request.setAttribute("option2", o2);
              request.setAttribute("option3", o3);
              //RequestDispatcher rd=getServletContext().getRequestDispatcher("/show.jsp");
              //rd.forward(request, response);
              out.println("<html>");
            out.println("<head>");
             out.println("<title>" + "shock!!!" + "</title>");
            out.println("</head>");
            out.println("<body>");
            out.println("<h2>"+"Read twice before u answer"+"<h2>");
            out.println("<p></p>");
            //why the value of q is not getting printed, instead i get null
            out.println("<h2>"+ q +"<h2>");
            out.println("how is it");
            out.println("</body>");
            out.println("</html>");
    }

  • JDBC adapter missed data from database

    Hello Experts
    We have a repeatative issues in JDBC sender adapter .While it is reading data from database sometimes we are facing the problem tat all the data is not read by adapter but PI read date is generated for all the records.
    Some times the issue happened like PI processed first three and last three data but missed 2-3 records from the middle portion.
    Please help me to know the reason for this error and how to resolve this types of error.
    Thanks in advance .
    Somenath

    Hello Stefan ,
    Thanks a lot for your reply .
    We have used the below  Select and update statement
    I am not expert in select query .Please suggest if the query is okay or it can be the error.
    SELECT * FROM [database].[dbo].[table]  WHERE [Delivery_Number] = (SELECT TOP 1 [Delivery_Number] FROM [database].[dbo].[table] where [PI_Read_Date] IS NULL ORDER BY [Delivery_Number] ASC) AND [PI_Read_Date] IS NULL ORDER BY [Transaction_ID] ASC
    UPDATE [database].[dbo].[table] SET [PI_Read_Date] = getdate() WHERE [Transaction_ID] in ( SELECT [Transaction_ID] FROM [database].[dbo].[table] WHERE [Delivery_Number] = (SELECT TOP 1 [Delivery_Number] FROM [database].[dbo].[table] where [PI_Read_Date] IS NULL) AND [PI_Read_Date] IS NULL)
    Please let me know what new features we can get if we set the the advanced parameter serializable.
    Hello Navin,
    We are using toad at data base side .If the lock occurs in the database side is it possible to generate tHe PI read date as the data is not read by PI?
    Thank you once again for you help.
    BR.
    somenath

  • Error:Failed to retrieve data from database [Vendor Code:3001]

    Hello FOlks am trying to run a crystal report but when i try to run it somehow returns this error i.e [Error:Failed to retrieve data from database [Vendor Code:3001], I have no clue wats happening with this.Can anybody please throw some light on this.Am providing the sql behind this report for reference.
    SELECT "CLIENT"."CLIENT_NAME",
            "RECOVERY"."AMOUNT",
            "RECOVERY"."RECOVERY_TRANSACTION_INTERNAL",
            "RECOVERY"."ALLOCATION_CHECK_AMOUNT",
            "RECOVERY"."RECOVERY_DATE"
       FROM "HRI1_OWNER"."CLIENT""CLIENT",
            "HRI1_OWNER"."EVENT_CASE""EVENT_CASE",
            "HRI1_OWNER"."SETTLEMENT""SETTLEMENT",
            "HRI1_OWNER"."RECOVERY""RECOVERY"
      WHERE "CLIENT"."CLIENT_ID" = "EVENT_CASE"."CLIENT_ID"
        AND "EVENT_CASE"."EVENT_CASE_ID" = "SETTLEMENT"."EVENT_CASE_ID"
        AND "SETTLEMENT"."SETTLEMENT_ID" = "RECOVERY"."SETTLEMENT_ID"
        AND "CLIENT"."CLIENT_CODE" <> 'CLIENT  1'
        AND "CLIENT"."MAJOR_CLIENT_ID" in
            (Select major_client_id
               from major_client
              where major_client_code in ('LA', 'PFG'))
      ORDER BY "CLIENT"."CLIENT_NAME"Edited by: user11961230 on Nov 12, 2009 6:57 AM

    @oradba:Hi Thanks for getting bak. Well i have ran the query using PL/SQL Developer tool and yes its mapping to ORA-03001:unimplemented feature. i dont know what the problem is.
    @centinul: well i dont have any views in there.but still cudnt figure out why its throwing tht error
    Thanks
    Edited by: user11961230 on Nov 12, 2009 7:12 AM

Maybe you are looking for

  • Need information on SMARTFORMS

    hi i m looking for some information on SMARTFORMS. why it is needed? what is difference between smartforms and sapscripting? if someone could send some docs. how to work on smartforms it will begreat

  • Can i get the new imovie if i have imovie 7.1.4

    I have a mac version 10.5.8  and i can't seem to get the mac app store

  • [openoffice] problem

    /opt/openoffice/program/soffice.bin: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openoffice/program/libbasegfx680li.so) Any idea ? Narcisse

  • How to get bom changed history?

    somtimes bom is changed with ECN , and sometimes without ECN, how to get all bom changed history? it appears that 'cdhdr' and 'cdcls' is the reference table, but some fields is implicit.  can you give me some idear?

  • Newbie: how to assign master switch without rebooting?

    Hi, Sometime ago, we installed 2 x 3750 switches connected by stackwise cable. I followed the instruction to boot up Switch A first and after 20 seconds Switch B. Then I configured an IP address to the stack. Then one day, there was a prolonged power