Internationalized Object data from database
Hi...
I like to know which concepts you use in web application in case you need dynamic object data internationalized. For static web pages I can use ResourceBoundles to get the data but I'm still searching for the ideal way to do this with Object data.
Let�s say you have a Product object which has a name and description in many different languages.
Preferably I like to do something like this
<c:out value="${product.name}"/>
to display the users preferred (session) language, and for the special case to force a language I might use something like this
<c:out value="${product.name}" locale="en_US"/>
Now my big question is how should I implement something like this. Should the product.getName() method include the logic to determine the users session to call something like product.getName(Locale)? Or should I implement a custom tag to handle cases like this?
What is your preferred way of doing this?
Thanks,
Gregor
How can use hashtable or Vector to create Jtree ?
the Hashtable's Data or Vector's Data from Database.
Similar Messages
-
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 AMAs 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>");
} -
How to populate Adobe LiveCycle Designer generated PDF Forms with data from Database in Windows app
Hi
I have a PDF template designed in Adobe LiveCycle Designer. This template has form fields which needs to be filled with data programmatically. I am using windows application in C#.Net 2005 in which I want to retrieve data from database and merge this data into PDF form in respective fields.
How this can be achieved?
I searched a lot & I found that we can process the XDP file generated from PDF to acheive this. I created the XDP file out of the PDF template created in designer. But I don't know how to merge data from database into that XDP file in respective fields and again convert this XDP file back to PDF programmatically. Can anybody help me ? This is urgent.
Thanks in advance.
SambhajiPlease ignore the above code.<br />The following one is correct one.<br />using System;<br />using System.Data;<br />using System.Configuration;<br />using System.Web;<br />using System.Web.Security;<br />using System.Web.UI;<br />using System.Web.UI.WebControls;<br />using System.Web.UI.WebControls.WebParts;<br />using System.Web.UI.HtmlControls;<br />using System.Text;<br />public partial class _Default : System.Web.UI.Page <br />{<br /> protected void Page_Load(object sender, EventArgs e)<br /> {<br /> Response.ContentType = "application/vnd.adobe.xdp+xml";<br /> StringBuilder responseString = new StringBuilder();<br /> responseString.Append("<?xml version='1.0' encoding='UTF-8'?>");<br /> responseString.Append("<?xfa generator='AdobeLiveCycleDesigner_V8.0' APIVersion='2.5.6290.0'?>");<br /> responseString.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>");<br /> responseString.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>");<br /> responseString.Append("<xfa:data>");<br /><br /> responseString.Append("<form1>");<br /> responseString.Append("<TextField1>Homer</TextField1>");<br /> responseString.Append("<TextField2>Simpson</TextField2>");<br /> responseString.Append("<field name ='DropDownList1'>");<br /> responseString.Append("<items save='1'>");<br /> responseString.Append("<text>1</text>");<br /> responseString.Append("<text>2</text>");<br /> responseString.Append("<text>3</text>");<br /> responseString.Append("</items>");<br /> responseString.Append("</field>");<br /><br /> responseString.Append("</form1>");<br /><br /> responseString.Append("</xfa:data>");<br /> responseString.Append("</xfa:datasets>");<br /> responseString.Append("<pdf href='C:\\Test.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />");<br /> responseString.Append("</xdp:xdp>");<br /><br /> Response.Write(responseString);<br /> Response.Flush();<br /> Response.End();<br /> }<br />}
-
Execution of queries - retreiving a part of data from database.
I use EJB3, OC4J, Oracle9i.
I try to get a part of data from database.
I write such code:
String sql = "SELECT object(o) FROM some_table o ORDER BY o.username ASC";
Query partialListQuery = em.createQuery(sql);
partialListQuery.setFirstResult(0);
partialListQuery.setMaxResults(10);
List<IssueHours> issueHoursList = partialListQuery.getResultList();
and in logs I get:
2006.11.16 11:09:06.224--ServerSession(977)--Connection(4561)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])--SELECT ID, NUMBER, HOURS, SUMMARY, PROJECT_NAME, USERNAME FROM SOME_TABLE ORDER BY USERNAME ASC
It is interesting whether some optimized query is built for retreiving a part of data or all data is carried from database to the server-side and filterred there.
If all data is retreived, how can I avoid that?is there any configuration? or... must I create myself optimized query?When maxResults is set the JDBC maxRows is set which allows the database to optimize what results are returned. Only the maxResults are returned from the database.
-
Extract data from database tables and download in pdf and csv
extract data from database tables and download in pdf and csv
hi how can i re-write my old form procedure in adf java. the procedure used to extract data from diffirent table and dowload the data in pdf and csv.am not downloading image, i what to extract data from diffirent tables in my database and download that data in pdf and csv. i would like to write this in java adf.i just what direction am not asking anyone to do my work this is my learning curve
the form code is
function merge_header3 return varchar2 is
begin
return '~FACILITY DESCRIPTION~ACCOUNT NO~BRANCH CODE~BANK REF NO.~P/P/ AMOUNT~Postal Address 1~Postal Address 2~Box Postal Code~Dep. Date~Month~BANK NAME~BRANCH NAME~ACCOUNT TYPE~DESCRIPTION~OBJECTIVE DESCRIPTION';
end;
procedure download_file (i_pbat integer) is
dir varchar2(80);
file_name1 varchar2(80);
file_name2 varchar2(80);
appl_code varchar2(80);
fil1 client_text_io.file_type;
fil2 client_text_io.file_type;
dat varchar2(1000);
DATA VARCHAR2(1000);
bvspro varchar2(100);
ssch varchar2(100);
bvspro_total number(20,2);
ssch_total number(20,2);
grand_total number(20,2);
cnt integer;
cursor pbat is
select *
from sms_payment_batches
where id = i_pbat
cursor pay (pb_id integer) is
select *
from sms_payment_vw
where pbat_id = pb_id
order by subsidy ASC,programme,beneficiary_name
cursor cgref (low varchar2) is
select *
from cg_ref_codes
where rv_domain ='SMS'
and rv_low_value = low
success boolean;
begin
set_application_property(cursor_style,'busy');
appl_code := sms_global.ref_code('SMS','APP_CODE','SMS',0);
dir := sms_global.ref_code('SMS','PAY_DIR','c:\sms\batch_payments',0);
success := webutil_file.create_directory(dir);
if webutil_file.file_is_directory(dir) then
null;
-- message ('directory exists');
else
-- message ('create directory ');
success := webutil_file.create_directory(dir);
-- if success then message ('directory exists'); end if;
end if;
for c_pbat in pbat loop
file_name1 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'pay.txt';
file_name2 := dir ||'\' || appl_code||c_pbat.batch_number||'-'||to_char(c_pbat.batch_dt,'yyyymmdd')||'merge.txt';
--message('create files ');
-- fil1 := client_text_io.fopen (file_name1,'W');
-- fil2 := client_text_io.fopen (file_name2,'W');
fil1 := client_text_io.fopen (file_name1,'W','');
fil2 := client_text_io.fopen (file_name2,'W','');
dat := 'FROM ACCOUNT NUMBER'
||'~'||'FROM ACCOUNT DESCRIPTION'
||'~'||'MY STATEMENT DESCRIPTION'
||'~'||'BENEFICIARY ACCOUNT NUMBER'
||'~'||'BENEFICIARY SUB ACCOUNT NUMBER'
||'~'||'BENEFICIARY BRANCH CODE'
||'~'||'BENEFICIARY NAME'
||'~'||'BENEFICIARY STATEMENT DESCRIPTION'
||'~'||'AMOUNT';
-- client_text_io.put_line(fil1,dat);
bvspro:= null;
ssch := null;
cnt := 0;
dat := '~'||lpad('~',16,'~');
for c_pay in pay(c_pbat.id) loop
--message('cpay loop ' || cnt);
if bvspro is null then
dat := lpad('~',16,'~');
dat := utility.put_field(1,c_pay.programme,dat,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
ssch := c_pay.subsidy;
grand_total := 0;
bvspro_total := 0;
ssch_total := 0;
end if;
if bvspro <> c_pay.programme then
dat := lpad('~',16,'~');
dat := utility.put_field(5,ssch_total,dat,'~');
dat := lpad('~',16,'~');
dat := utility.put_field(5,bvspro_total,dat,'~');
dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
client_text_io.put_line(fil2,dat);
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.programme,dat,'~');
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
bvspro := c_pay.programme;
ssch := c_pay.subsidy;
bvspro_total := 0;
ssch_total := 0;
cnt :=0;
end if;
if ssch <> c_pay.subsidy then
dat := lpad('~',16,'~');
dat := utility.put_field(5,ssch_total,dat,'~');
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,c_pay.subsidy,dat,'~');
client_text_io.put_line(fil2,dat);
dat := merge_header3;
client_text_io.put_line(fil2,dat);
ssch := c_pay.subsidy;
ssch_total := 0;
cnt :=0;
end if;
bvspro_total := bvspro_total + c_pay.amount;
ssch_total := ssch_total + c_pay.amount;
grand_total := grand_total + c_pay.amount;
cnt := cnt +1;
--message('bfore write file 2 ' );
client_text_io.put_line(fil2
,cnt
||'~'|| c_pay.beneficiary_name
||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER ||''
||'~'||c_pay.BRANCH_CODE ||''
||'~'|| c_pay.BENEFICIARY_STATEMENT_DESC
||'~'|| c_pay.AMOUNT
||'~'|| c_pay.address_line1
||'~'|| c_pay.address_line2
||'~'|| c_pay.postal_code
||'~'|| TO_CHAR(c_pay.deposit_date,'DD-Mon-YYYY')
||'~'|| c_pay.month
||'~'|| c_pay.bank
||'~'|| c_pay.bank_branch
||'~'|| c_pay.account_type
||'~'|| c_pay.subsidy
||'~'|| c_pay.programme)
DATA := c_pay.FROM_ACCOUNT_NUMBER
||'~'||c_pay.FROM_ACCOUNT_DESCR
||'~'||c_pay.MY_STATEMENT_DESCR
||'~'||c_pay.BENEFICIARY_ACCOUNT_NUMBER
||'~'
||'~'||c_pay.BRANCH_CODE
||'~'||c_pay.BENEFICIARY_NAME
||'~'||c_pay.BENEFICIARY_STATEMENT_DESC
||'~'||c_pay.AMOUNT;
DATA := REPLACE(DATA, ',' , ' ' );
DATA := REPLACE(DATA, '~' , ',' );
--message (cnt ||' ' || data);
--message('bfore write file 1 ' );
client_text_io.put_line(fil1, data);
end loop;
--message ('end of write');
dat := lpad('~',16,'~');
dat := utility.put_field(6,ssch_total,dat,'~');
dat := lpad('~',16,'~');
dat := utility.put_field(1,'Total:' || bvspro,dat,'~');
dat := utility.put_field(5,bvspro_total,dat,'~');
client_text_io.put_line(fil2,dat);
dat := lpad('~',16,'~');
client_text_io.put_line(fil2,dat);
dat := utility.put_field(1,'Grand Total:' ,dat,'~');
dat := utility.put_field(5,grand_total,dat,'~');
client_text_io.put_line(fil2,dat);
-- close file
for i in 1..50 loop
if substr(i,-1) = 0 then
message ('flush ' || i);
end if;
client_text_io.put_line(fil1, lpad(' ',2000));
client_text_io.put_line(fil2, lpad(' ',2000));
client_text_io.put_line(fil1, lpad(' ',2000));
client_text_io.put_line(fil2, lpad(' ',2000));
end loop;
client_text_io.fclose(fil1);
client_text_io.fclose(fil2);
end loop;
set_application_property(cursor_style,'default');
exception
when others then
message(sqlcode ||' ' ||sqlerrm);
end download_file; i try this but this code onlydownload image not data from database tables
public void downloadImage(FacesContext facesContext, OutputStream outputStream)
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
// get an ADF attributevalue from the ADF page definitions
AttributeBinding attr = (AttributeBinding) bindings.getControlBinding("DocumentImage");
if (attr == null)
return;
// the value is a BlobDomain data type
BlobDomain blob = (BlobDomain) attr.getInputValue();
try
{ // copy the data from the BlobDomain to the output stream
IOUtils.copy(blob.getInputStream(), outputStream);
// cloase the blob to release the recources
blob.closeInputStream();
// flush the output stream
outputStream.flush();
catch (IOException e)
// handle errors
e.printStackTrace();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, e.getMessage(), "");
FacesContext.getCurrentInstance().addMessage(null, msg);
}You should ask your forum in the ADF-forum.
-
I cant back up my all data from database
how can i take backup my all data from database with large object library (blob)
when i want back up i writing this statement on "cmd"
exp dbas/dbas@ddds file=D:\dms\ddfm.dmp
so it's only just backup data without large object library, any table contain large object library it can't take it
so i would like take backup all data from databaseOracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
and i am used win7 32bit
when i want back up i writing this statement on "cmd"
exp dbas/dbas@ddds file=D:\dms\ddfm.dmp
so it's only just backup data without large object library, any table contain large object library it can't take it
so i would like take backup all data from database
Edited by: 940639 on Jun 27, 2012 12:35 AM -
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);
}thanxhi 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 -
Pull the data from database.
Hi EveryBody,
I have a requirement in universe if the end user will select the date from (1/8/14 to 10/8/14) then pull the data from the database. but when the end user select the data more than 10 days(e.g 1/8/14 to 15/8/14 etc...) then no need to pull the data from database.
how will write the filter in the universe?
how will achieve this? please help me.
Thank you.Hi ,
I am assuming you are giving prompt for start date and end date respectively start_date and end_date.
please see the below work around. (below is pseudo code)
1. create one dummy objects as
case when @prompt(end_date) - @prompt(start_date) <= 10 then = 1 end
Remember text used in dummy object should be same as you use it for you date prompts
2. pull this objects in where clause along with your date prompts as
dummy_object = 1
It will work as below :=
your report will be prompted for start_date and end_date .
Same values will be passed to dummy objects.
When dummy object will be executed , it will check for end_date-start_date <=10 or not.
If it is less then 10 then query will executed else it will come out as where clause is not satisfied.
Hope this answers your question :-).
Regards
Jeevan -
Failed to retrieve data from database?
I am a new user
When I try to Preview a document I am prompted to enter in database information.
I have tried a few times to connect to my server and
continuously keep getting the same error page
No matter what I enter in the two fields, this is what pops up.
"Failed to retrieve data from database"
" Details: ADO Error Code:0x
Source: Microsoft OLE DB Provider SQL server
Description: Invalid object name: ScratchWO.dbo.tblsyslistviewprint'.
SQL State:42502
Code:208"
When the OLE DB(ADO) page opens and asks for a server and a database, what is needed to stop the error from happening
If anyone has any information that would be great !SQL State:42502 means an user authorization error. Check the user and it's access to the target database.
-
Want JTree e.g. of populating data from database.
I want ur JTree example of populating data from database, can u plz give me that eg.?
Awaiting 4 ur reply.Hi,
AFAIK, there is no direct approach to populate a JTree directly from a resultset. However, JTree can use a DOM tree as its model by using the adapter pattern. The procedure to do this is well-documented in the SUN website and the link is provided below. The code to convert a resultset to XML is provided below:
protected void resultSetToXML(OutputStream out,
ResultSet rs,
String stylesheet)
throws IOException, ServletException {
// Create reader and source objects
SqlXMLReader sxreader = new SqlXMLReader();
SqlInputSource sis = new SqlInputSource(rs);
// Create SAX source and StreamResult for transform
SAXSource source = new SAXSource(sxreader, sis);
StreamResult result = new StreamResult(out);
// Perform XSLT transform to get results. If "stylesheet"
// is NULL, then use identity transform. Otherwise, parse
// stylesheet and build transformer for it.
try {
// Create XSLT transformer
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t;
if (stylesheet == null) {
t = tf.newTransformer();
} else {
// Read XSL stylesheet from app archive and wrap it as
// a StreamSource. Then use it to construct a transformer.
InputStream xslstream = _config.getServletContext().
getResourceAsStream(stylesheet);
StreamSource xslsource = new StreamSource(xslstream);
t = tf.newTransformer(xslsource);
// Do transform
t.transform(source, result);
} catch (TransformerException tx) {
throw new ServletException(tx);
The classes SQLXMLReader and other classes used in this example are available in the following java packages.
import java.sql.*;
import javax.sql.DataSource;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.sax.*;
import javax.xml.transform.stream.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import org.xml.sax.helpers.AttributesImpl;
The following is the link that explains how to load a JTree from DOM.
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPDOM6.html
Cheers,
vidyut -
How do i add data from database to JTable ! Urgent
How do i add data from database to the columns of JTable?.
hi,
Thanks for ur link. but this is just a part of my application which i am developing user interface in swing package for which i want to know how to show data to user in the table format where by table input data will be from the database. say something like todays activity is shown to the user in table format... So u have any idea of how to do this... -
[webdynpro] How to get the data from database and store in Excel sheet
Hi All-
I am developing an application in Webdynpro and I need to provide a URL ( link ) which if clicked , need to collect the data from Database ( SQL Server ) and puts in an Excel Sheet corresponding fields and opens the sheet.....
Please look into this issue and help me out......
Regards,
CrisHi Cris,
Add-on to wat santosh has pointed to:
Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
(Or) If you have implemented your logic to get Database records below Blog should guide you in opening an excel with ur records.
Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
Regards,
N. -
Oracle form: how to retrieve data from database to pop list
I have problem in retrieving data from database to item list in
oracle forms.
Can anyone help me.
thanks.The next is an example but you can find this information in
Forms Help:
DECLARE
G_DESCS RECORDGROUP;
ERRCODE NUMBER;
rg_id RECORDGROUP;
rg_name VARCHAR2(40) := 'Descripciones';
BEGIN
rg_id := FIND_GROUP(rg_name);
IF Id_Null(rg_id) THEN
G_DESCS := Create_Group_From_Query (rg_name, 'SELECT
DESCRIPCION DESCRIPCION, DESCRIPCION DESC2 FROM FORMAS_PAGO);
ERRCODE := POPULATE_GROUP(G_DESCS);
POPULATE_LIST('FORMAS_PAGO.CMBDESCRIPCION',G_DESCS);
END IF;
END;
Saludos.
Mauricio. -
Issue to load data from database to XML file. error: ODI-40768
Hi,
While I am trying to load data from database to XML following error is appearing.
ODI-1228: Task TEST_XML_DATA (Integration) fails on the target XML connection MyLOCALXSD.
Caused By: java.sql.SQLException: ODI-40768: Could not save the file <default>:C:\DATA_FILE\www.xml because a class java.io.IOException occurred and said: The filename, directory name, or volume label syntax is incorrect
at com.sunopsis.jdbc.driver.xml.SnpsXmlFile.writeToFile(SnpsXmlFile.java:751)
at com.sunopsis.jdbc.driver.xml.SnpsXmlConnection.internalExecute(SnpsXmlConnection.java:769)
at com.sunopsis.jdbc.driver.xml.SnpsXmlPreparedStatement.execute(SnpsXmlPreparedStatement.java:46)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:166)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:540)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
at java.lang.Thread.run(Thread.java:662)
jdbc url: jdbc:snps:xml?d=C:\test_xsd.xsd&s=TESTSQL&re=employeesX&ro=true
physical schema: TESTSQL
Knowledge modules are:
LKM: LKM SQL to SQL
IKM: IKM XML Control Append
CKM: CKM SQL
Parameters set are:
CREATE_XML_FILE: true
XML_PATH:<default>:C:\DATA_FILE\www.xml
I have tried to change the directory path but error is still there.
Could some one please help me to resolve the issue?
Regards,
user1672911Hi,
The trouble in "<default>:" - if you set XML_PATH as C:\DATA_FILE\www.xml instead <default>:C:\DATA_FILE\www.xml- it will work correctly.
Greetings,
Eugene -
TRANSFER OF DATA FROM DATABASE TO APPLICATION SERVER
I have to upload /transfer data from database to application server .
I am not able to get it.
If anyone have any solution to it,
post it to me.
thanks*& Report <name>
REPORT name.
DATA:
BEGIN OF FS_SPFLI,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
COUNTRYFR TYPE SPFLI-COUNTRYFR,
CITYFROM TYPE SPFLI-CITYFROM,
AIRPFROM TYPE SPFLI-AIRPFROM,
COUNTRYTO TYPE SPFLI-COUNTRYTO,
CITYTO TYPE SPFLI-CITYTO,
AIRPTO TYPE SPFLI-AIRPTO,
FLTIME TYPE SPFLI-FLTIME,
DEPTIME TYPE SPFLI-DEPTIME,
ARRTIME TYPE SPFLI-ARRTIME,
DISTANCE TYPE SPFLI-DISTANCE,
DISTID TYPE SPFLI-DISTID,
FLTYPE TYPE SPFLI-FLTYPE,
PERIOD TYPE SPFLI-PERIOD,
END OF FS_SPFLI.
DATA:
T_SPFLI LIKE
STANDARD TABLE
OF FS_SPFLI.
DATA:
BEGIN OF FS_TABLE,
CHAR(100) TYPE C,
END OF FS_TABLE.
DATA:
T_TABLE LIKE
STANDARD TABLE
OF FS_TABLE.
DATA:
BEGIN OF FS_TABLE1,
CHAR(100) TYPE C,
END OF FS_TABLE1.
DATA:
T_TABLE1 LIKE
STANDARD TABLE
OF FS_TABLE1.
SELECT CARRID
CONNID
COUNTRYFR
CITYFROM
AIRPFROM
COUNTRYTO
CITYTO
AIRPTO
FLTIME
DEPTIME
ARRTIME
DISTANCE
DISTID
FLTYPE
PERIOD
FROM SPFLI
INTO TABLE T_SPFLI.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'd:\files\p_spfli04'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = T_SPFLI
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'd:\files\p_spfli04'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = T_TABLE
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*LOOP AT T_TABLE INTO FS_TABLE.
WRITE:
/ FS_TABLE-CHAR.
*ENDLOOP.
OPEN DATASET 'p_spfli04' FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC EQ 0.
MESSAGE 'File Already Exists' TYPE 'I'.
STOP.
ELSE.
CLOSE DATASET 'p_spfli04'.
ENDIF.
OPEN DATASET 'P_SPFLI02' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT T_TABLE INTO FS_TABLE.
TRANSFER FS_TABLE TO 'p_spfli04'.
ENDLOOP.
CLOSE DATASET 'p_spfli04'.
*ENDIF.
OPEN DATASET 'p_spfli04' FOR INPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT T_TABLE INTO FS_TABLE.
READ DATASET 'p_spfli04' INTO FS_TABLE.
APPEND FS_TABLE-CHAR TO T_TABLE1.
ENDLOOP.
Here is the sample code to download and upload the file onto presentation server and then using OPEN DATASET you'll be able to transfer the data to APPLICATION SERVER....
Regards,
Pavan P.
Maybe you are looking for
-
My delete button in my to do's closes the app. I've closed all the background running apps and have restarted my phone and even tried syncing to my iTunes. It's driving me nuts. Please help!
-
N73 Model 0543566 old firmware and bluetooth
Hi all! I have a N73 with firmware: V 3.0704.1.0.1 19-01-2007 RM-133 (c) Nokia N73 (80.01) I am experiencing a problem with my bluetooth audio device (a JVC bluetooth handsfree addon for my car radio). After using my car handsfree installation (it wo
-
SEVERE: Failed to unlock all EM-related accounts
while configuring the em dbcontrol I am getting this errror. checked the account status of dbsnmp, sysman and checked the path for perl bin. every thing is ok. spool is as below. pls help out to configure. *$ emca -config dbcontrol db* STARTED EMCA a
-
Cannot add playlists to folders in iphone 5 / itunes for mac
Does anyone know why one cannot add playlists to folders in iphone 5. When I drag a playlist to a folder on my "Devices" on my iMac in itunes 10 it does not show up on my phone after it syncs. I should note that I currently have 3 folders with playli
-
Reg Significance of Field CLUSTD in MSTD TAble.
hi, pls let me know the significance of the field CLUSTD which is of type LRAW and length 2886 in MSTD TAble. Thanks in advance