JSP: Data retrieval from database

Hi Everyone...
I know that inorder to extract a value from a database and output to the screen the syntax will be
<%= rst.getString("DeliveryID")%>.
But what if I want to extract the value from the database and instead of outputting to the screen, I want to assign it to a variable I have declared.
I tried the following but it did not work:
<% String name = request.getString("DeliveryID"); %>.
I hope someone can help me out in this.
regards
BabyJava

Hi Guys...
Really thanks for the advice, I guess you guys are right. But it's too late for me to change anything now so I am more or less stuck with the existing design. I have got one new problem though.
I want to update all values of a table at once and this is the SQL statement I used, but it's not working. I guess the problem could be with the way I am using the wildcard. Here is the code:
String query = " UPDATE Customer SET CustomerID = '"+CustID +"'," +
                       " CustomerName = '"+CustName+"', CustomerPassword = '"+CustPassword+"', " +
                       " CustomerType = '"+CustType+"' , CustomerAddress = '"+CustAddress+"' ," +
                       " CustomerHandphone = '"+CustHandphone+"'" +
                       " WHERE CustomerID LIKE 'C%' ";
                       I am getting a general error. Is there anything wrong with my code??
regards
BabyJava

Similar Messages

  • Tell me how to format a date retrieved from a MS SQL Server 2000 database?

    Tell me how to format a date retrieved from an MS SQL Server 2000 database for various uses in my JSP page?

    Or if you want to use JSTL instead of a scriptlet see:
    http://forum.java.sun.com/thread.jspa?threadID=676754&tstart=0

  • Data Could not be retrieved from database...

    Hi All,
    I have a problem on Excel 2007 while refreshing (for pivot table) data from SQL Server view:
    "Data could not be retrieved from database. Check the database server or contact your database administrator. Make sure that external database is availiable, and then try the operation again"
    Excel file is distributed on about 20 workstations in network with the same Excel version, and problem occurs only on one station. I have checked credentials and connection between workstation and server and it seems to be ok.
    Any ideas?

    it is problem, because sql server is not member of domain... so I'm using sql aunthentication.
    strange thing is that from any other workstations (aldo in domain) it works fine when providing SQL user. I'm supposing that it is problem with some excel settings

  • Playing a video file retrieved from database using JMF

    Hello!
    I am developing a multimedia application that has to store videos, music, pictures in a database. I did a little searching and found that JMF is a very good solution in playing video/music using Java. I found some examples to play the video/music stored on the hard drive (as separate files), but i have to be able to take the video/music from the database, and feed it to the JMF player. Has anyone some suggestions about how this could be done?
    Thanks in advance!
    Edited by: radu.miron on May 8, 2008 9:03 AM

    Well, i think i didn't make myself clear enough :). i know how to retreive the data from the database. The thing is this: let's suppose i have a 700 MB movie stored in the database. One option to play that movie would be to retrieve it from the DB, create a file somewhere on the disk, and put the data retrieved from the database in that file. But this involves that the disk will be overflooded when let's say 100 people watch 100 different movies. Another option (as i see it) would be to gradually take parts of the movie from the database (first 50 MB, then another 50 MB, then another and so on), and feed it to the JMF player. The user will watch the movie, but will not have the whole movie available, just a part of it. As he watches it, the application takes the next chunck of movie data and feeds it to the JMF player. That was the question i intended to ask, if anyone has any idea regarding the second option, and not the part with retrieving from the database, but the part with giving the JMF player video data to play.
    The example i found on the web with JMF player is the following:
    import javax.swing.*;*
    *import javax.media.*;
    import java.awt.*;*
    *import java.awt.event.*;
    import java.net.*;*
    *import java.io.*;
    public class PlayVideo extends JFrame {
         Player player;
         Component center;
         Component south;
         public PlayVideo() {
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              JButton button = new JButton("Select File");
              ActionListener listener =
                   new ActionListener() {
                   public void actionPerformed(
                             ActionEvent event) {
                        JFileChooser chooser =
                             new JFileChooser(".");
                        int status =
                             chooser.showOpenDialog(PlayVideo.this);
                        if (status ==
                             JFileChooser.APPROVE_OPTION) {
                             File file = chooser.getSelectedFile();
                             try {
                                  load(file);
                             } catch (Exception e) {
                                  System.err.println("Try again: " + e);
              button.addActionListener(listener);
              getContentPane().add(button,
                        BorderLayout.NORTH);
              pack();
              show();
         public void load(final File file)
         throws Exception {
              URL url = file.toURL();
              final Container contentPane =
                   getContentPane();
              if (player != null) {
                   player.stop();
              player = Manager.createPlayer(url);
              ControllerListener listener =
                   new ControllerAdapter() {
                   public void realizeComplete(
                             RealizeCompleteEvent event) {
                        Component vc =
                             player.getVisualComponent();
                        if (vc != null) {
                             contentPane.add(vc,
                                       BorderLayout.CENTER);
                             center = vc;
                        } else {
                             if (center != null) {
                                  contentPane.remove(center);
                                  contentPane.validate();
                        Component cpc =
                             player.getControlPanelComponent();
                        if (cpc != null) {
                             contentPane.add(cpc,
                                       BorderLayout.SOUTH);
                             south = cpc;
                        } else {
                             if (south != null) {
                                  contentPane.remove(south);
                                  contentPane.validate();
                        pack();
                        setTitle(file.getName());
              player.addControllerListener(listener);
              player.start();
         public static void main(String args[]) {
              PlayVideo pv = new PlayVideo();
    }but this example plays a video stored on the disk ( player = Manager.createPlayer(url); ), rather than a chunck of data (the whole movie or parts of it) retrieved from the database.
    Sorry for the misunderstanding!
    Cheers!

  • Re: [Re: Keys retrieval from database]

    Hi Joseph,
    Thank you for your reply.I am using ODBC to connect Forte application with the database.And I went through the document, and tried all the possible ways, I could't succed in retrieval of whole data.I tried the sql execute procedure also.I will the error message
    after sometime.How does it related with escript?please clarify.
    Thank you,
    J.Babu
    [email protected] wrote:
    Hello Jendran,
    take a look at your 'Online-Help'. Search for 'DBDataType' (DBColumnDesc) and
    'GetDatabaseDesc' and look if your question is answered.
    See the 'Accessing Database Guide' Page 236 for a complete description of the
    call ('sql execute procedure' not 'sql execute Immediate procedure').
    Look wether you connect via ODBC or Direct to the database in your
    DBResourceMgr (Perhaps you have to look how this is specified in your
    environment in 'econsole'). If you have any more problems please copy
    the error-message in your email, to see what forte says to this error.
    Hope this helps
    Joseph Mirwald
    At 04:30 18.06.98, you wrote:
    Hi guys,
    Have any one used the method GetDatabaseDesc() of DbSession classto retrieve columns, primary keys and Foreign keys of a database? I
    couldn't retrieve any information except columns of MsSql server
    database.If possible give some information.
    I couldn't execute stored procedure from Forte, what could be theproblem? we tried with sql execute Immediate procedure.
    Thank you in advance,
    J.Babu
    Get free e-mail and a permanent address at http://www.netaddress.com/?N=1
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Babu,
    Note that though you will be able to get column information on
    most of the
    databases, some databases do not maintain or provide access to
    key
    information. For these databases, specifying DB_IN_KEYINFO and
    DB_IN_FOREIGNKEYINFO has no effect. Oracle, Ingres, and Informix
    do support key information. Check vendor documentation for
    other databases
    on specific platforms.
    As rightly mentioned by Joseph Mirwald, you might want to email
    a copy
    of the error message that you get.
    Good luck!
    Ajith Kallambella M.
    Forte Systems Engineer,
    Internationational Business Corporation.
    From: [email protected][SMTP:[email protected]]
    Reply To: [email protected]
    Sent: Thursday, June 18, 1998 12:30 AM
    To: [email protected]
    Cc: [email protected]; [email protected]
    Subject: Keys retrieval from database
    Hi guys,
    Have any one used the method GetDatabaseDesc() of DbSession
    class to retrieve columns, primary keys and Foreign keys of a
    database? I couldn't retrieve any information except columns of MsSql
    server database.If possible give some information.
    I couldn't execute stored procedure from Forte, what could be
    the problem? we tried with sql execute Immediate procedure.
    Thank you in advance,
    J.Babu
    Get free e-mail and a permanent address at
    http://www.netaddress.com/?N=1
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Can I use stored procedures to improve data retrieval from the database?

    I have been requested to get multiple pieces of data from multiple tables and return the output in an array for use in a Java program.
    Eliminating multiple calls to the database. Currently, the data is retrieved from the database in multiple steps but to eliminate
    possible bottlenecks in the future, I created several complex sql statements.
    For instance,
    In the first table there are 20 columns of data. has a column named type which can have the one of these values: line, inn, or bsc
    In the second table there are 6 columns of data. has the additional data for type line
    In the third table there are 7 columns of data. has the additional data for type inn
    In the fourth table there are 2 columns of data. has data regardless of type
    etc...
    Depending on a specific column value retrieved (inn) from the first table:
    I need to collect all 20 columns in the first table and get all the columns in third table and the columns in the fourth table, etc.
    Question: How can I remove the duplicate primary key columns without specifying for each table the column names to be returned?
    I used the wildcard SELECT * because I didn't want to have to update the retrieval methods if additional columns are added to these
    secondary tables.
    example of my sql for type inn data:
    select * from first_table f, third_table s, fourth_table t
    where (f.column1='xxxx' and f.column2='xxxx') (the 'xxxx' are passed into the sql statement)
    and
    ((s.column1=f.column1 and s.column2=f.column2)
    and
    (f.column3=t.column1));
    Currently, I've duplicated the separate sqls for each valid type found in the first table (at least a dozen types). The only difference is
    the table name. Instead of the third table I use the second table, etc.
    The MAIN Question: How can I set this up to have one sql to handle each type? I want to eliminate having over a dozen duplicated sqls. Can I
    incorporate this into a stored procedure or something? If so, how? Can anyone provide sample coding?
    Your help is very much appreciated. Thank you.
    GD

    Hi, Salah.
    Use "Exec" in your query to run procedures.
    SAPbobsCOM.Recordset     oRS;
    oRS = (SAPbobsCOM.Recordset)pCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
    oRS.DoQuery ("EXEC YourStoredProcName");
    Triggers are not supported in SDK.
    Regards,
    Aleksey

  • Caching data read from database

    I have a big performace problem in our J2EE application. We use jsp and servlets to process a request. Servlet gets the results from database which are stored in a vector of dataobjects and vector is stored in session. We display only 20 rows in jsp and provide page navigation to view more data by Next and Prev links. The problem is we want to store results in request object instead of session variable but then that data is not availabe for Next and Prev links. We don't want to do another search to view more data. Is there a way to cache the data so that while view more data by page navigation we don't need to hit database since request object would be cleared at that time. I am clueless. I hope I explained the problem properly. Any help on this would be highly appreciated

    You're not clueless, you said it yourself.
    To make info available over multiple requests, you need to use a session variable rather than the request.

  • Data Retrieval from SSRS 2008 R2 to SQL Server 2012 standard

    Hello,
    We have a virtual machine running SSRS 2008 R2 and a physical server running SQL server 2012 standard.  We are having an issue with a report that is taking almost 10 minutes for the data to be retrieved from the sql 2012 database.  We used the
    execution logging query to debug and analyze.  We see that it renders and processes very fast, but the data retrieval time is very slow.  When the same query is run using sql studio mgr. from the SSRS server it runs just fine...it
    takes seconds for the results to come up.
    I don't believe there is a compatibilty issue because other reports run fine.  We're just having problems with one report.

    A long shot, but I've seen where the data type of a report parameter is mismatched against the data type of the table it is being compared against.  SQL profiler would show this clearly.  
    This would explain why the query returns quickly in ssms but not with the report.  

  • Saving to and retrieving from database

    Hi,
    How can I save my program's data in a database and how can I view the data?
    S.A.T

    You can save data to a database using the SqlCommand.ExecuteNonQuery method:
    https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.executenonquery(v=vs.110).aspx
    string query = "INSERT INTO TABLE (col1) VALUES (1)";
    using (SqlConnection connection = new SqlConnection(
    "your connection string...."))
    SqlCommand command = new SqlCommand(queryString, connection);
    command.Connection.Open();
    command.ExecuteNonQuery();
    You will have to supply a connection string to the database:
    http://www.connectionstrings.com/sql-server/
    ...and an SQL query (INSERT, UPDATE) to be executed against the database.
    You can retrieve data similarly using a SqlDataAdapter that fills a DataSet:
    http://www.dotnetperls.com/sqldataadapter
    DataTable t = new DataTable();
    using (SqlConnection c = new SqlConnection(
    "connection string..."))
    c.Open();
    // 2
    // Create new DataAdapter
    using (SqlDataAdapter a = new SqlDataAdapter(
    "SELECT * FROM EmployeeIDs", c))
    // 3
    // Use DataAdapter to fill DataTable
    a.Fill(t);
    Please remember to mark helpful posts as answer to close your threads and then start a new one if you have a new question.

  • CRVS2010 beta - Date field from database does not display in report

    Hi there - can someone please help?!
    I am getting a problem where a date field from the database does not display in the report viewer (It displays on my dev machine, but not on the client machines...details given below)
    I upgraded to VS 2010
    I am using the CRVS2010 Beta
    My development machine is Windows 7 - and so is my fellow developer's
    We are using Microsoft SQL Server 2000
    We run the queries within VS and then we send the data table to VS using .SetDataSource
    We have a few reports which display the date on our dev machines (whether we run the EXE or from within Visual Studio)
    When we roll out to the client machines (running Windows XP SP3) then everything works, except that the date does not display (on quite a few reports)
    This is the only real issue I have had - a show stopper for me
    The rest works well - any input will be greatly appreciated
    Regards,
    Ridwan

    Hi Ridwan,
    After much testing I have it all working now using CRDB_adoplus.dll as a data source ( XML )
    Alter your Config file to look like this:
    <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0"/>
    </startup>
    Then using the code below, and CR requires the Schema to be able to read the date format.
    private void SetToXML_Click(object sender, EventArgs e)
    CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
    ISCDReportClientDocument rcd;
    rcd = rptClientDoc;
    string connString = "Provider=SQLOLEDB;Data Source=dwcb12003;Database=xtreme;User ID=sb;Password=password";
    string sqlString = "Select * From Orders";
    OleDbConnection oleConn = new OleDbConnection(connString);
    OleDbDataAdapter oleAdapter = new OleDbDataAdapter(sqlString, oleConn);
    //OleDbDataAdapter oleAdapter2 = new OleDbDataAdapter(sqlString2, oleConn);
    DataTable dt1 = new DataTable("Orders");
    oleAdapter.Fill(dt1);
    System.Data.DataSet ds = new System.Data.DataSet();
    // We need the schema to get the data formats
    ds.WriteXml("c:
    sc.xml", XmlWriteMode.WriteSchema);
    //Create a new Database Table to replace the reports current table.
    CrystalDecisions.ReportAppServer.DataDefModel.Table boTable = new CrystalDecisions.ReportAppServer.DataDefModel.Table();
    //boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
    PropertyBag boMainPropertyBag = new PropertyBag();
    //boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
    //In the main property bag (boMainPropertyBag)
    PropertyBag boInnerPropertyBag = new PropertyBag();
    //Set the attributes for the boInnerPropertyBag
    boInnerPropertyBag.Add("File Path ", @"C:\sc.xml");
    boInnerPropertyBag.Add("Internal Connection ID", "{680eee31-a16e-4f48-8efa-8765193dccdd}");
    //Set the attributes for the boMainPropertyBag
    boMainPropertyBag.Add("Database DLL", "crdb_adoplus.dll");
    boMainPropertyBag.Add("QE_DatabaseName", "");
    boMainPropertyBag.Add("QE_DatabaseType", "");
    //Add the QE_LogonProperties we set in the boInnerPropertyBag Object
    boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);
    boMainPropertyBag.Add("QE_ServerDescription", "NewDataSet");
    boMainPropertyBag.Add("QE_SQLDB", "False");
    boMainPropertyBag.Add("SSO Enabled", "False");
    //Create a new ConnectionInfo object
    CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo =
    new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
    //Pass the database properties to a connection info object
    boConnectionInfo.Attributes = boMainPropertyBag;
    //Set the connection kind
    boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
    //*EDIT* Set the User Name and Password if required.
    boConnectionInfo.UserName = "";
    boConnectionInfo.Password = "";
    //Pass the connection information to the table
    boTable.ConnectionInfo = boConnectionInfo;
    //Get the Database Tables Collection for your report
    CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables;
    boTables = rptClientDoc.DatabaseController.Database.Tables;
    //For each table in the report:
    // - Set the Table Name properties.
    // - Set the table location in the report to use the new modified table
    boTable.Name = "Orders";
    boTable.QualifiedName = "Orders";
    boTable.Alias = "Orders";
    rptClientDoc.DatabaseController.SetTableLocation(boTables[0], boTable);
    //Verify the database after adding substituting the new table.
    //To ensure that the table updates properly when adding Command tables or Stored Procedures.
    rptClientDoc.VerifyDatabase();
    MessageBox.Show("Data Source Set", "RAS", MessageBoxButtons.OK, MessageBoxIcon.Information);
    Thanks again
    Don

  • Reading Data Clusters from Database ??

    Hi at all,
    how can I read Data from a ClusterTable´`?
    In the Database "STXL" is a field "CLUSTR" and "CLUSTD" and i want see the input. But before i can see it, i must read this Data Cluster.
    How does it work``?
    IMPORT tab = itab
    FROM DATABASE stxl(tx)
    ID   wa_TDOBJECT
    TO wa_stxl.

    well, normally you got FM´s which enable you to do selects or whatever with cluster tables.
    in your case it would be FM READ_TEXT or related FM´s. I do ABAP programming for quite a while now, and i never came to the situation where i manually had needed to read a cluster table.

  • Data retrieval from sad face ipod

    So, two nights ago my ipod (40gig 3rd gen(? 4th? 1.5 years old; warranty expired)) randomly died while in the middle of playing music. It whirred and clicked and eventually gave me the unhappy face, and that is how it's stayed for the past 48 hours. Now, there are plenty of people in this same boat, as a little browsing of the forums has showed me, so I'm not asking for how to possibly fix it, but...
    What I do want to know: is there a service to get the data off the ipod? Reformatting the machine is all fine and good, but I'm living abroad and most of my CDs are currently on the other side of the world. My friend said that you could pay $50 for Apple to retrieve the data from your old drive, but I haven't seen anything like that on the website (perhaps it is only for Macs?)
    Anyway, has anyone heard of a data retrieval service for ipods, or some other method of getting data off an ipod that won't connect to the computer? (I tried putting it in data mode and it just laughed at me...or frowned, I suppose.)
    Thanks for any advice you can give...
      Windows XP  

    Is your iPod fully charged? (connect it to the Mac for 4 hours to charge the battery)
    Your post is not very clear on the problem, but normally Resetting the iPod will get rid of the sad face, on the iPod sceen, but may not get rid of your unhappy face.
    To Reset - Press Menu and Center Button for about 10 secs till the Apple logo comes ON.
    Here is the support document that may help you.
    http://support.apple.com/kb/TS1373?viewlocale=en_US
    Good Luck & Have a nice day!

  • Data retrieval from ZL table

    I need to retrieve data from ZL table and prepare a report comparing the Actual, Previous and Old records in the table for an employee for a particular period.
    Are there any particular function modules for this data retrieval?
    Thanks.

    Hi bala,
    I did not get what you were trying to tell me. I went to SE37 and tried for anything that starts with "zlit" .. but returned no results.
    And also I dont want time management to payroll.
    I want to retrieve data from the B2 in PCL2 cluster.
    i.e I want to retrieve data from the ZL table in the cluster for a particular payperiod and particular employee.
    Thanks very much in advance!

  • Data retrieval from JMS queue using single SOA composite in a clustered env

    Hi,
    I have following situation:
    1) A requester SOA composite (Composite1)is reading data from a File
    2) Mediator is routing data received from Composite1 and writing in a JMS queue.
    3) A provider composite (Composite2) is reading from the JMS queue.
    Both Composite1 and Composite2 is deployed in a clustered environment.
    Problem is Composite2 is not able to read data sequentially from JMS Queue sometime (for example out of 30000 transactions its failing once). Here it's a queue and only one producer and only one consumer is there.
    What may cause this issue? I thought a single producer and single consumer on a queue will guarantee FIFO retrieval . Could you please advise where may be the gap?
    Thanks
    Edited by: user1054373 on Sep 18, 2012 11:29 PM

    Hi,
    I thought a single producer and single consumer on a queue will guarantee FIFO retrieval Java Message Service Specification does not guarantee ordered message delivery when applications use distributed queues...
    Using Weblogic Message Unit-of-Order may solve your issue...
    http://docs.oracle.com/cd/E23943_01/web.1111/e13727/uoo.htm#JMSPG389
    Hope this helps...
    Cheers,
    Vlad

  • SQL Data Access from database

     Hi Friends,
     I want to access data from database, User will enter Start Date and end date , based on that , data will be get retried.
    Is it possible to write a SQL Query, Where A SQL Query will take care user start and end date. Start date and end date is not fixed, it will be vary based on user.
    Thanks for co-operation.
    Regards,
    Pritam A.

    Pritama,
    Yes, your query looks fine. It should work perfectly. You could alternatively, get input from user into variables and use them in your query as shown below:
    declare @user_startdate datetime
    set @user_startdate='10/Oct/2013 1:00:04'
    declare @user_enddate datetime
    set @user_enddate='14/Oct/2013 1:00:04'
    SELECT * FROM GT1
    WHERE datetime1 BETWEEN @user_startdate AND @user_enddate
    Is there anything else you are facing a problem with? Your query is correct and gives no problems..
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

Maybe you are looking for

  • SharePoint 2013 List & linked Document Set Project Help Needed

    I have struggling to find the best solution for a recent project. I'm sure someone will have a better suggestion than what I have come up with. Project Requests Project Tracking and Documents Status and other data Project Documents Offsite Syncing fo

  • How to change the length of massage line

    Good afternoon everyone, The message line only shows the first 80 characters of error messages. The message line on the window is large enough to hold 150 characters. Any advice/solution/insult would be appreciated. Thank you,

  • ICloud Trial: to discontinue

    Hi, Have been looking where to not extend the trial I have at iCloud. Can someone tell me where this can be done in the Oracle Cloud services or admin section? Cheers, Patrick

  • I have an iPhone 5. Just got another identical iPhone 5 from the company.

    How can I manage to let in proper sync? iMessages, iTunes, RunKeeper etc.?

  • Subramanian

    import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import jav