Retriving data from database using JDBC and mysql.
st=con.createStatement();
st.executeUpdate("INSERT INTO temperature(`temp`) VALUES ('"+name+"')"); ResultSet rs = st.executeQuery("Select * from temperature");
String s1="";
while(rs.next())
s1= rs.getString(1);
document.write(s1+"-----------------------------");
}when i am retriving data from data base i am getting data which i inserted before.how to display present inserted data? i heard we should use scrollable.can any one how to do this.
Date&time: Thu Feb 28 18:41:40 PST 2008 -----------------------------NANDA----------------------------
[[email protected]----1name=2name=3name=4name=5name=6-----------------------------
1123456-----------------------------123456-----------------------------1,2,3,4,5,20-----------------------------
Hi,
st=con.createStatement();
st.executeUpdate("INSERT INTO temperature(`temp`) VALUES ('"+name+"')");
//Changes in the query
ResultSet rs = st.executeQuery("Select * from temperature where temp ='"+name+"' ");
String s1="";
while(rs.next())
s1= rs.getString(1);
document.write(s1+"-----------------------------");
//Select * from temperature where temp ='"+name+"'
The above query which results the last updated information
Similar Messages
-
Xml data from database using jdbc
I should get the xml data from database. Is this scenario possible using jdbc adapter ? If possible, how can I get it ?. Plz help me
I suppose that probably, xml data are stored in a BlobImage Field.
You can use a Stored Procedure on Database Side, to select and put out the xml data structured in output fields or structures.
From JDBC Sender channel, you can call the SP, that raise out a Structure formatted like the XML Data stored in Xml Database field.
In your opinion, this should be a possible way to achieve this issue? -
How save & retrive data from database using flex, coldfusion, sql server
hi , i am very new in flex, i am trying to insert data in
database using flex2, coldfusion, sql server. any one can help me
please. or give me any example.Hi try to goto the following sites, you will get some
direction to think
http://weblogs.macromedia.com/pent/archives/2006/11/example_of_flex.cfm
http://pdxphp.org/node/258
Good Luck -
Failed to retrive data from database Error
Hi,
I am working on Crystal report XI R2.0. Back end is Oracle and I am migrating the oracle database to MySQL database. After migrating the DB from oracle to MySQL, saved and closed the report. If I open the same reprt I am getting the following error.
"Failed to retrive the data from database.Details:3D000.[MySQL][ODBC 5.1 Driver][mysqld-5.1.24-rc-community][No database selected]"
Please let me know how to resolve this issue.
Thanks,
UdayaHi Kalva,
Please can you let us know the version of MySql to which you have migrated the database? Are you able to create a new report with the help of the migrated database?
You can try changing the connection type to ODBC, OLEDB etc.Also,you can use the 'Set Datasource Location' in the 'Database Expert' to make the report point to the correct database.
Thanks,
Alok. -
Question regarding Polling data from database using DB Adapters in BPEL
Hi,
I have the following question regarding Polling data from database using DB Adapters in BPEL -
If I am selecting data from multiple tables/view to ultimately generate hierarchical xml document, is there a way that I specify polling all of these tables/views. Is polling limited only to one table/view?
Thanks
RaviHi Ravi,
your question seems to have been answered for the question of polling a set of tables with one as the root, and getting back a hierarchical xml representing multiple related tables.
However you can also poll for changes to both the root table and its related tables. Not sure if this was your question or the one already answered. If the former please check out the sample
bpel/samples/tutorials/122.DBAdapter/advanced/polling/PollingForChildUpdates
Thanks
Steve -
How to retrive data from database views or projection views
how to retrive data from database views or projection views
Hi chintam,
1. Very simple
2. Just like normal select statement.
3. Select * from VIEWNAME.
4. (Instead of the tablename, we just have to give the viewname)
regards,
amit m. -
How to Retrive data from db using EJB in WebDynpro
hi...
i m using EJB's for backend connection in WebDynpro .in which i m able to store data in sapdb .for this i followed one tutorial which i have mentioned bellow which works perfectly.Now in the same Tutorial i want to retrive the data from database and disply it in WebDynpro
i .e i want to disply bonus when i give ssn no and also i want to disply all data in db.
Please help me as i m totaly new to this environment and also first time i m working on EJB.its very urgent
Thanks and Regards
Sonal<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c</a>hi...
i m using EJB's for backend connection in WebDynpro .in which i m able to store data in sapdb .for this i followed one tutorial which i have mentioned bellow which works perfectly.Now in the same Tutorial i want to retrive the data from database and disply it in WebDynpro
i .e i want to disply bonus when i give ssn no and also i want to disply all data in db.
Please help me as i m totaly new to this environment and also first time i m working on EJB.its very urgent
Thanks and Regards
Sonal<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c</a> -
Problem when simultaneously retriving data from berkeleydb using web applic
Hi all
Plz Help
i am using jboss server .
my problem is :
i have 2lacks recodrs in berkeleydatabase
when i try to retrive data it working properly for one browser
if i start retrive data simultaneously using two IES it getting this exception
how to solve this problem,i mean separeate session for separate client
in java session trking techique i applied ,but here not working retriving data from berkeleydb.collision occur
11:47:08,468 ERROR [STDERR] Database handles still open at environment close
11:47:08,468 ERROR [STDERR] Open database handle: smscsucc.db
11:47:08,468 ERROR [STDERR] java.lang.IllegalArgumentException: Invalid argument
11:47:08,468 ERROR [STDERR] at com.sleepycat.db.internal.db_javaJNI.DbEnv_cl
ose0(Native Method)
11:47:08,468 ERROR [STDERR] at com.sleepycat.db.internal.DbEnv.close0(DbEnv.
java:208)
11:47:08,468 ERROR [STDERR] at com.sleepycat.db.internal.DbEnv.close(DbEnv.j
ava:76)
11:47:08,468 ERROR [STDERR] at com.sleepycat.db.Environment.close(Environmen
t.java:39)
11:47:08,468 ERROR [STDERR] at daos.RetriveDao.getData(RetriveDao.java:131)
11:47:08,468 ERROR [STDERR] at controllers.MainServlet.getData(MainServlet.j
ava:47)
11:47:08,468 ERROR [STDERR] at controllers.MainServlet.serviceHelper(MainSer
vlet.java:76)
11:47:08,468 ERROR [STDERR] at controllers.MainServlet.doGet(MainServlet.jav
a:101)
11:47:08,468 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:697)
11:47:08,468 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
rvlet.java:810)
11:47:08,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
in.internalDoFilter(ApplicationFilterChain.java:252)
11:47:08,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
in.doFilter(ApplicationFilterChain.java:173)
11:47:08,468 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilte
r.doFilter(ReplyHeaderFilter.java:96)
11:47:08,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
in.internalDoFilter(ApplicationFilterChain.java:202)
11:47:08,468 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterCha
in.doFilter(ApplicationFilterChain.java:173)
11:47:08,468 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve
.invoke(StandardWrapperValve.java:213)
11:47:08,468 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve
.invoke(StandardContextValve.java:178)
11:47:08,468 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssocia
tionValve.invoke(SecurityAssociationValve.java:175)
11:47:08,468 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValv
e.invoke(JaccContextValve.java:74)
11:47:08,468 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.in
voke(StandardHostValve.java:126)
11:47:08,468 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.i
nvoke(ErrorReportValve.java:105)
11:47:08,468 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.
invoke(StandardEngineValve.java:107)
11:47:08,468 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.s
ervice(CoyoteAdapter.java:148)
11:47:08,468 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.proc
ess(Http11Processor.java:869)
11:47:08,468 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$H
ttp11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
11:47:08,468 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.pr
ocessSocket(PoolTcpEndpoint.java:527)
11:47:08,468 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerT
hread.run(MasterSlaveWorkerThread.java:112)
11:47:08,468 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
# An unexpected error has been detected by HotSpot Virtual Machine:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x29693a05, pid=832, tid=3776
# Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode)
# Problematic frame:
# C [libdb44.dll+0x33a05]
# An error report file with more information is saved as hs_err_pid832.log
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
Press any key to continue . . .
Thnking you
Thanks & Regards
Venkat GadarlaHello,
Your question is about Berkeley DB -- this is the Berkeley DB Java Edition forum. Please repost this over at:
Berkeley DB
Thanks.
Charles Lamb -
Help , How to get data from database using recordset with UI API
I want to get a data from database
when I want to create recordset i notice that UI API didn't has record set
so I created recordset using DI API (SAPbobscom.recordset and SAPbobscom.company)
======================================================
Dim oCompanyUI As SAPbouiCOM.Company <<UI API
Dim oRecSet As New SAPbobsCOM.Recordset << DI API
Dim oCompanyDI As New SAPbobsCOM.Company << DI API
'=====================================================
oCompanyDI.Connect
Set oRecSet = oCompanyDI.GetBusinessObject(BoRecordset)
oRecSet.DoQuery ("SELECT T0.CardCode, T0.CardName FROM OCRD T0")
SBO_Application.MessageBox oRecSet.Fields.Item(1).Value
======================================================
but I got an error it said "you are not connected to company"
I'm really don't have an idea about how to get a data from using UI API (exp I want to get a date or costumer code)
can someone help me please, I really need it
Thanksyou need a single sign on
Dim oDICompany As SAPbobsCOM.Company
Dim sCookie As String
Dim sConnStr As String
Dim ret As Integer
oDICompany = New SAPbobsCOM.Company
sCookie = oDICompany.GetContextCookie
sConnStr = SBO_Application.Company.GetConnectionContext(sCookie)
If oDICompany.Connected Then
oDICompany.Disconnect()
End If
ret = oDICompany.SetSboLoginContext(sConnStr)
If Not ret = 0 Then
SBO_Application.MessageBox("set Login Context failed!")
Exit Sub
End If
ret = oDICompany.Connect()
If Not ret = 0 Then
SBO_Application.MessageBox("Company Connect failed!")
End If -
Saving data in database using textbox and save button
Hello. I just want a help about my code because when i close the application the data that i add is not been saved.
Here is my code of save:
function saveData(event:MouseEvent):void
status.text = "Saving data";
insertStmt = new SQLStatement();
insertStmt.sqlConnection = conn;
var sql:String = "INSERT INTO employees (firstName, lastName, salary) VALUES (:param, :param1, :param2)";
insertStmt.text = sql;
insertStmt.parameters[":param"] = firstName.text;
insertStmt.parameters[":param1"] = lastName.text;
insertStmt.parameters[":param2"] = salary.text;
insertStmt.addEventListener(SQLEvent.RESULT, insertResult);
insertStmt.addEventListener(SQLErrorEvent.ERROR, insertError);
insertStmt.execute();
Here is the full code:
import fl.data.DataProvider;
import flash.data.SQLResult;
import flash.data.SQLConnection;
import flash.filesystem.File;
import flash.data.SQLStatement;
import flash.data.SQLConnection;
var conn:SQLConnection;
var createStmt:SQLStatement;
var insertStmt:SQLStatement;
var insertStmt2:SQLStatement;
var insertStmt3:SQLStatement;
var selectStmt:SQLStatement;
var insert1Complete:Boolean = false;
var insert2Complete:Boolean = false;
saveBtn.addEventListener(MouseEvent.CLICK, saveData);
loadBtn.addEventListener(MouseEvent.CLICK, getData);
init();
function init():void
conn = new SQLConnection();
conn.addEventListener(SQLEvent.OPEN, openSuccess);
conn.addEventListener(SQLErrorEvent.ERROR, openFailure);
status.text = "Creating and opening database";
// Use these two lines for an on-disk database
// but be aware that the second time you run the app you'll get errors from
// creating duplicate records.
// var dbFile:File = File.applicationStorageDirectory.resolvePath("DBSample.db");
// conn.openAsync(dbFile);
// Use this line for an in-memory database
conn.openAsync(null);
function openSuccess(event:SQLEvent):void
conn.removeEventListener(SQLEvent.OPEN, openSuccess);
conn.removeEventListener(SQLErrorEvent.ERROR, openFailure);
createTable();
function openFailure(event:SQLErrorEvent):void
conn.removeEventListener(SQLEvent.OPEN, openSuccess);
conn.removeEventListener(SQLErrorEvent.ERROR, openFailure);
status.text = "Error opening database";
trace("event.error.message:", event.error.message);
trace("event.error.details:", event.error.details);
function createTable():void
status.text = "Creating table";
createStmt = new SQLStatement();
createStmt.sqlConnection = conn;
var sql:String = "";
sql += "CREATE TABLE IF NOT EXISTS employees (";
sql += " empId INTEGER PRIMARY KEY AUTOINCREMENT,";
sql += " firstName TEXT,";
sql += " lastName TEXT,";
sql += " salary NUMERIC CHECK (salary >= 0) DEFAULT 0";
sql += ")";
createStmt.text = sql;
createStmt.addEventListener(SQLEvent.RESULT, createResult);
createStmt.addEventListener(SQLErrorEvent.ERROR, createError);
createStmt.execute();
function createResult(event:SQLEvent):void
createStmt.removeEventListener(SQLEvent.RESULT, createResult);
createStmt.removeEventListener(SQLErrorEvent.ERROR, createError);
addData();
function createError(event:SQLErrorEvent):void
status.text = "Error creating table";
createStmt.removeEventListener(SQLEvent.RESULT, createResult);
createStmt.removeEventListener(SQLErrorEvent.ERROR, createError);
trace("CREATE TABLE error:", event.error);
trace("event.error.message:", event.error.message);
trace("event.error.details:", event.error.details);
function addData():void
status.text = "Adding data to table";
insertStmt = new SQLStatement();
insertStmt.sqlConnection = conn;
var sql:String = "";
sql += "INSERT INTO employees (firstName, lastName, salary) ";
sql += "VALUES ('Bob', 'Smith', 8000)";
insertStmt.text = sql;
insertStmt.addEventListener(SQLEvent.RESULT, insertResult);
insertStmt.addEventListener(SQLErrorEvent.ERROR, insertError);
insertStmt.execute();
insertStmt2 = new SQLStatement();
insertStmt2.sqlConnection = conn;
var sql2:String = "";
sql2 += "INSERT INTO employees (firstName, lastName, salary) ";
sql2 += "VALUES ('John', 'Jones', 8200)";
insertStmt2.text = sql2;
insertStmt2.addEventListener(SQLEvent.RESULT, insertResult);
insertStmt2.addEventListener(SQLErrorEvent.ERROR, insertError);
insertStmt2.execute();
function insertResult(event:SQLEvent):void
var stmt:SQLStatement = event.target as SQLStatement;
stmt.removeEventListener(SQLEvent.RESULT, insertResult);
stmt.removeEventListener(SQLErrorEvent.ERROR, insertError);
if (stmt == insertStmt)
insert1Complete = true;
else
insert2Complete = true;
if (insert1Complete && insert2Complete)
status.text = "Ready to load data";
function insertError(event:SQLErrorEvent):void
status.text = "Error inserting data";
insertStmt.removeEventListener(SQLEvent.RESULT, insertResult);
insertStmt.removeEventListener(SQLErrorEvent.ERROR, insertError);
trace("INSERT error:", event.error);
trace("event.error.message:", event.error.message);
trace("event.error.details:", event.error.details);
function getData(event:MouseEvent):void
status.text = "Loading data";
selectStmt = new SQLStatement();
selectStmt.sqlConnection = conn;
var sql:String = "SELECT empId, firstName, lastName, salary FROM employees";
selectStmt.text = sql;
selectStmt.addEventListener(SQLEvent.RESULT, selectResult);
selectStmt.addEventListener(SQLErrorEvent.ERROR, selectError);
selectStmt.execute();
function saveData(event:MouseEvent):void
status.text = "Saving data";
insertStmt = new SQLStatement();
insertStmt.sqlConnection = conn;
var sql:String = "INSERT INTO employees (firstName, lastName, salary) VALUES (:param, :param1, :param2)";
insertStmt.text = sql;
insertStmt.parameters[":param"] = firstName.text;
insertStmt.parameters[":param1"] = lastName.text;
insertStmt.parameters[":param2"] = salary.text;
insertStmt.addEventListener(SQLEvent.RESULT, insertResult);
insertStmt.addEventListener(SQLErrorEvent.ERROR, insertError);
insertStmt.execute();
function selectResult(event:SQLEvent):void
status.text = "Data loaded";
selectStmt.removeEventListener(SQLEvent.RESULT, selectResult);
selectStmt.removeEventListener(SQLErrorEvent.ERROR, selectError);
var result:SQLResult = selectStmt.getResult();
resultsGrid.dataProvider = new DataProvider(result.data);
// var numRows:int = result.data.length;
// for (var i:int = 0; i < numRows; i++)
// var output:String = "";
// for (var prop:String in result.data[i])
// output += prop + ": " + result.data[i][prop] + "; ";
// trace("row[" + i.toString() + "]\t", output);
function selectError(event:SQLErrorEvent):void
status.text = "Error loading data";
selectStmt.removeEventListener(SQLEvent.RESULT, selectResult);
selectStmt.removeEventListener(SQLErrorEvent.ERROR, selectError);
trace("SELECT error:", event.error);
trace("event.error.message:", event.error.message);
trace("event.error.details:", event.error.details);Your database system may well have a setting for character encoding when creating new databases. If you set that to unicode JDBC should store and retrieve UNICODE strings automatically.
As to the HTML side, you should generally use UTF-8 encoding. You need an editor which understands UTF-8. JSPs and servlets have ways of specifying the encoding which goes into the http headers. For static HTML pages you may have to add a header like:
<META http-equiv="Content-type" value="text/HTML; charset=UTF-8">
When receiving form data you need to do
request.setCharacterEncoding("UTF-8"); -
How to fetch data from Database using SUP MBOs
I'm learning to develop blackberry apps using SUP.I am new to both blackberry api and SUP.
I need to make a login page for a Student and then validate the username and password entered using data from a database.
I need to check the database for the username and password entered. What should be my next step? How do i get this data from the database. Using findAll() method is not working . Do i need to connect to SCC or unwired server first. If yes , then someone please provide a sample code for it.Hi!, I see your code and I see that you have a fee errors, try to use this:
import java.text.*;
import java.sql.*;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.OutputStream;
* NOTE: You must put the try-catch and your sql code into the get method
/** Servlet program to take fetchdata from database and display that on the broswer*/
public class Fetchdata
extends HttpServlet {
String query = new String();
String uid = "ashvini";
String pwd = "******";
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, Exception {
try {
Connection con = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:Testing";
con = DriverManager.getConnection(url, uid, pwd);
Statement s = con.createStatement();
query = "select * from gowri.msllst1";
ResultSet rs = s.executeQuery(query);
response.setContentType("text/html");
ServletOutputStream out = response.getOutputStream();
out.println("<HTML>" + "<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=CENTER>" + title + "</H1>\n" +
"<table>" + " <th>ITEM Code</th>");
while (rs.next()) {
out.println("<tr><td>" + rs.getString(1).trim() + "</td></tr>");//I change </tr></td> for </td></tr>
} //end of while
out.println("</table></BODY></HTML>");
catch (Exception e) {
System.out.println(e);
} //end of doGet method
}I hope this help you :) -
Error while retrieving data from sql using jdbc adapter
hi all,
i m working on one scenario where i m sending data using HTTP and receiver is jdbc adapter which is retrieving me data from sql server.
i have checked the structure both for req and res.
i m getting this error
<SAP:Error>
<SAP:Category>Application</SAP:Category>
<SAP:Code>MAPPING.EXCEPTION_DURING_EXECUTE</SAP:Code>
<SAP:P1>com/sap/xi/tf/_INF57285_DB_HR_RES_</SAP:P1>
<SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>
<SAP:P3>RuntimeException in Message-Mapping transformatio~</SAP:P3>
<SAP:Stack>During the application mapping com/sap/xi/tf/_INF57285_DB_HR_RES_ a com.sap.aii.utilxi.misc.api.BaseRuntimeException was thrown: RuntimeException in Message-Mapping transformatio~</SAP:Stack>
</SAP:Error>
can somebody help me with this.
Thanks & Regards
Arunathnks bhavesh i think i made it that way
JDBC REQ
<ns:INF57285_DB_Request xmlns:ns="http://www.infosys.com/xi/training/hyd/57285">
<Employee>
<EmpDetails action="SELECT">
<table>EmpDetails</table>
<access>
<Name />
<EmpId />
<Band />
<Salary />
</access>
<Key>
<EmpId>57285</EmpId>
</Key>
</EmpDetails>
</Employee>
</ns:INF57285_DB_Request>
JDBC RES
<ns:INF57285_DB_Request_response xmlns:ns="http://www.infosys.com/xi/training/hyd/57285">
<Employee_response>
<row>
<Name>aruna</Name>
<EmpId>57285</EmpId>
<Band>A</Band>
<Salary>4675776</Salary>
</row>
</Employee_response>
</ns:INF57285_DB_Request_response>
my hr req is which i mapped with DB req
<ns:INF57285_HR_Req xmlns:ns="http://www.infosys.com/xi/training/hyd/57285">
<REQUEST>
<EmpNo>57285</EmpNo>
</REQUEST>
</ns:INF57285_HR_Req>
my hr res is which i mapped with DB res
<ns:INF57285_HR_Res xmlns:ns="http://www.infosys.com/xi/training/hyd/57285">
<response>
<row>
<Name>aruna</Name>
<Empld>57285</Empld>
<Salary>4675776</Salary>
</row>
</response>
</ns:INF57285_HR_Res>
and interestingly i am not getting any error in sxmb_moni
it's not showing any error
plz suggest me something wht to do ....
thnks & regards
Aruna -
Displaying data from database using Repeater
Hi,
I have created a database with 3 column in a table.Where column 1 is username and column 2 is Report name.
Column 1 has 2 user :-
user1-----> ABC
user2-----> PQR. So if i select ABC i am getting 2 records from Report based on ABC and if i select PQR i get 1 record from Report based on PQR.Till here i have done
Now I am using repeater control and binding the data from the database.but the problem is I want hyperlink on the data which is populating.Since i am using repeater,i am able to fetch 2 records for Report.I want hyperlink on it so i am using anchor tag with
href,Now both the records are redirecting to the same page.I want each record should redirect to different page.Please help me if any one know about these.
Thansk Regards,
SimanchalHi,
Base on your description here:
"I want hyperlink on it so i am using anchor tag with href,Now both the records are redirecting to the same page"
I agree with Bob you have to consult this issue on this forum:
http://forums.asp.net/24.aspx/1?Web+Forms+Data+Controls
Regards,
Barry Wang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to fetch data from DataBase using Servlet ?
Hi all,
Till now, i was just sending values from web page and receive the data in excel format using servlets.
But, now, i want to fetch data from data base. I will be giving inputs in the web page(for the query)....ON click of submit button,
Servlet should be called.
Depending on the input, query has to be executed, and response should be sent to the user.
How to do it?
Code
import java.text.*;
import java.sql.*;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.OutputStream;
/** Simple servlet that reads three parameters from the html
form
public class Fetchdata extends HttpServlet
String query=new String();
String uid="ashvini";
String pwd="******";
try
Connection con=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:Testing";
con = DriverManager.getConnection(url, uid, pwd);
Statement s = con.createStatement();
query = "select * from gowri.msllst1";
ResultSet rs = s.executeQuery(query);
public void doGet(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException
response.setContentType("application/vnd.ms-excel");
ServletOutputStream out=response.getOutputStream();
out.println("<HTML>" +"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=CENTER>" + title + "</H1>\n" +
"<table>" +" <th>ITEM Code</th>");
while(rs.next())
out.println("<tr><td>" rs.getString(1).trim()"</tr></td>");
}//end of while
out.println("</table></BODY></HTML>");
}//end of doGet method
}catch(Exception e)
System.out.println(e);
It is giving error message as:
C:\Program Files\Apache Tomcat 4.0\webapps\general\srvlt>javac Fetchdata.java
Fetchdata.java:17: illegal start of type
try
^
Fetchdata.java:48: <identifier> expected
^
2 errors
Is this format is correct? am i placing this doGet method at the right place? is my program's logic is correct?
Please help me?
Regards
AShviniThere is some mistakes in ur code.....how can try catch exists outside a function???
make use of try catch isde ur doGet method and put
Connection con=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:Testing";
con = DriverManager.getConnection(url, uid, pwd);
Statement s = con.createStatement();
query = "select * from gowri.msllst1";
ResultSet rs = s.executeQuery(query);
isdie doGet method, for the time being,
i think u get me..
regards
shanu -
Retriving data from database through EntityBean to WebDynpro
Dear SDN's,
I have integrated my EJB appliaction into WebDynpro via Data Access Command Bean.
Here is my scenario.
1.Created a Dictionary Project,
2.Created a EntityBean,
In Entity Bean, i have created a finder method using the query - FindByAllAccounts
used the EJB QL to retrieve the records from the database using the following syntax in EntityBean.
<b><query>
<query-method>
<method-name>findByAllAccounts</method-name>
<method-params/>
</query-method>
<ejb-ql>select object(s) from ServiceTypeBean s</ejb-ql>
</query></b>
3.In Session bean, the viewAllServiceTypes method which will be invoked from within the Command Bean is called the entity bean of the local home, findByAllAccount
Command Bean invoked the session bean, viewAllServiceTypes. It returns the resultSet dataType
In Web Dynpro, add the code shown below in the QueryAll button and also, the EAR file is added to the Web Dynpro as a sharing reference
After the execution of my WebDynpro,
it returns no records. It should return 2 records. I dont know where it goes wrong.
Correct me if anything is worng here.
Here what my doubt is, the return of the Entity bean and Session Bean is Collection type.
If i store the retrieved records in collection Object like vector, how can i differentiate each record to display as individual.
anyway I tried by converting the Collection Object to ResultSet.
Here is the code in the command Bean,
public ResultSet execute1()
Collection col=new Vector();
ResultSet rs=null;
try{
col=theSrType.viewAllServiceTypes();
rs=(ResultSet) col.iterator();
}catch(Exception e){
e.printStackTrace();
return rs;
I am just calling the execute1() method in my Webdynpro program.
I know here something is wrong but my aim is to retireve set of records from database via Entity bean to display in WebDynpro Table.
Your help will be appreciated.
Regards,
Sireesha.BFor helper class you have to create a separate java project.
Auxillary class is required to store the data from the entity bean in a form that can be displayed.
For this purpose, the auxillary class must contain a field for each relevant value. The fields will be named similar to their definition in the entity bean.
For example:Entity Bean has persistent fields id, firstname, lastname.
Auxillary Class should contain all these fields and getter and setter method to access these fields.
In your EJB module project give this auxillary class project reference.
In the session bean parse the collection of Entitty Bean local references and convert it to collection of auxillary class reference.
In the command bean declare a collection type variable, write getter and setter methods for this variable, call the session bean method and assign it declared collection type variable.You dont need to write any logic inside command bean method.
Go through this URL for more information.
<a href="http://help.sap.com/saphelp_erp2005vp/helpdata/en/70/13353094af154a91cbe982d7dd0118/frameset.htm">http://help.sap.com/saphelp_erp2005vp/helpdata/en/70/13353094af154a91cbe982d7dd0118/frameset.htm</a>
Message was edited by:
Monalisa Biswal
Maybe you are looking for
-
Hi, I'll get right to the issue i'm having with my HP Prime calculator. Recently during an exam where i was calculating the moments of inertia of certain bodies i encountered what i can only describe as a bug in the software because I can't figure a
-
Wireless devices showing up as "LAN"
On a WRT 190AC. **bleep**? And while I have your attention, is it possible to turn off IPv6? I don't see that anywhere.
-
What is the best way to import movers from my Sony camcorder to my MacBook pro?
-
APPCRASH on startup... need help
I have been using the adobe CS3 suite for a couple years with no problems... All of a sudden I can't access any of the suite. Whenever i clck on any of the icons I do not even get a splash screen... all that I get is the MS warning Adobe *** has stop
-
Since installing OSX 10, my iMac randomly shuts down and restarts. I can not determine why this is happening. Any ideas?