GET String from databse
Hi All,
can any one help me on urgent basis for below
I am having database connection program having a query which generate a string for XML format.
after executing this program i am getting string as a null.
please have a look for below program
sql.append("SELECT XMLRoot (XMLELEMENT ")
.append(" (\"CC_Hierarchy\",xmlattributes ( '0' as \"id\" ),") // \" nothing but "" in sql editor
.append(" (SELECT DBMS_XMLGEN.getxmltype")
.append(" (DBMS_XMLGEN.newcontextfromhierarchy")
.append(" ('SELECT LEVEL,")
.append(" XMLELEMENT (\"item\",")
.append(" xmlattributes (cc_nbr || '' - '' ||CC_NM||DECODE(CC_NBR,DIV_CC_NODE,'' <font color=\"3349FF\"> <b>''||BU_NM||''</b> <font color=\"F62B04\"><b> ''||DIV_NM||'' </b><font color=\"FF33B7\"> <b> ''||CFO_NM||''</b><font color=\"green\"><b>''||FM_NM||''</b>'','' '') AS \"text\",")
.append(" cc_nbr AS \"id\",")
.append(" DECODE (SUBSTR (cc_nbr, 0, 1),''S'', 1, 0 ) AS \"child\", ")
.append(" DECODE (SUBSTR (cc_nbr, 0, 1),''S'', ''folderClosed.gif'', NULL) AS \"im0\", ")
.append(" DECODE (SUBSTR (cc_nbr, 0, 1),''S'', ''folderOpen.gif'',NULL) AS \"im1\", ")
.append(" DECODE (SUBSTR (cc_nbr, 0, 1),''S'', ''folderClosed.gif'', NULL) AS \"im2\" ")
.append(" ), ")
.append(" XMLELEMENT (\"userdata\", ")
.append(" xmlattributes (''itemType'' as \"name\" ), ")
.append(" DECODE ( SUBSTR (cC_NBR, 0, 1),''S'',''PNODE'',''LNODE'') ")
.append(" ) ) ")
.append(" FROM tableName ")
.append(" START WITH LTRIM (TRIM (cc_nbr), ''0'') = LTRIM (TRIM (''S531306''), ''0'') ")
.append(" CONNECT BY NOCYCLE parent_cc_nbr = PRIOR cc_nbr' ")
.append(" )")
.append(" )")
.append(" FROM DUAL)")
.append(" ), VERSION '1.0\" encoding=\"iso-8859-1') xmldoc ")
.append(" FROM DUAL");
System.out.println(sql.toString());
pst = connection.prepareStatement(sql.toString());
rs = pst.executeQuery();
while(rs.next()){
System.out.println(rs.getString("xmldoc")); //here getting null
}
Hi,
you can do this as below:
This example shows the use of getObject to directly get the XMLType from the ResultSet. This code snippet is the easiest way to get the XMLType from the ResultSet.
import oracle.xdb.XMLType;
PreparedStatement stmt = conn.prepareStatement(
"select e.poDoc from po_xml_tab e");
ResultSet rset = stmt.executeQuery();
while(rset.next())
// get the XMLType
XMLType poxml = (XMLType)rset.getObject(1);
// get the XML as a string...
String poString = poxml.getStringVal();
}
Similar Messages
-
How to get string from jtextpane along with its attributes
sir,
How to get string from jtextpane along with its attributes
i,e font,size,style,color etc.
please help me out.
my mail id is [email protected]JTextPane extends JTextComponent
JTextComponent.getDocument()
a Document is a set of Element, see Document.getRootElements(). Each Element has attributes, stored within an AttributSet object see Element.getAttributes()
a Document can also be rendered as a String, see Document.getText( offest, length ), use it with 0 and Document.getLength() as parameters. -
How can I get String from Bytes
I want to get String from array of bytes but i have some trouble from byte that it's lager more than 128. How can I do ???
Please hepl me. Thanks very much.This program is only to show you what the relationships are between unsigned byte, signed byte, character, and binary values. Because of the constraints that Java has, the program code is not especially clean. Run the program and see if it helps. As has been said, the character output is dependent on the encoding in use.
Here is a sample of some of its output:
Unsigned byte= 189 Signed byte= -67 Character= � Binary= 10111101
Unsigned byte= 190 Signed byte= -66 Character= � Binary= 10111110
Unsigned byte= 191 Signed byte= -65 Character= � Binary= 10111111
Unsigned byte= 192 Signed byte= -64 Character= � Binary= 11000000
Unsigned byte= 244 Signed byte= -12 Character= � Binary= 11110100
Unsigned byte= 245 Signed byte= -11 Character= � Binary= 11110101
Unsigned byte= 246 Signed byte= -10 Character= � Binary= 11110110
public class ATest {
public static void main(String[] args) {
int in;
byte by;
String bin;
char chr;
for(in=0; in<256; in++) {
// create a byte whose binary value is equal to the;
// integer loop counter;
by = (byte)in;
// mask off sign extension [that I don't agree with!] and;
// cast the resultant 8 bits to a char;
chr = (char)(by & 0x00ff);
// since there's no Byte.toInteger, must cast to int to get;
// binary string and then delete unwanted portion of string;
if(in<128) {
bin = Integer.toBinaryString((int)by);
} else {
bin = Integer.toBinaryString((int)by).substring(24);
// print everything;
System.out.println(
"Unsigned byte= "+in+
" Signed byte= "+by+
" Character= "+chr+
" Binary= "+bin);
} -
How does javascript get string from applet?
hi, sir/madam:
I use an applet to deal with simulation, make the results to be a string and want to save it in a text file. Certainly, using applet to write local file is not good method (though I have some idea about it). I want that javaScript write something in browser and I save it with my mouse (manual) as a text file.
thank for your help.
xn
could javaScript write/read local file?There is a nice JavaScript forum that you can visit if you have tough JavaScript questions:
http://forums.webdeveloper.com/forumdisplay.php?s=a23bf83c088c66ac3adde0c3c5616bae&forumid=3
I'm not implying that ppl here don't know JavaScript or anything like that.....
In answering your questions, a Java applet can read from and write to local disk if proper permissions are granted either via a signed applet or setting the Java access right. Signing an applet can be a royal pain in the butt because you have to sign it one way for IE, another way for NN4, and yet another way if you use a plugin, etc....but here is a link in case you're interested:
http://developer.java.sun.com/developer/qow/archive/167/index.jsp
A JavaScript definitely cannot read from or write to a local disk unless you get help from something like MS ASP or VB scripts. The only reason you were able to read thru the appletviewer is because it's not a true browser and it's written by Sun to work with their own product.
As far as using javascript to get information from an applet, you can try to make your applet scriptable via Netscape JSObject. I know for sure it works with IE and NN4+ but last time I tried, Sun and Netscape were still having trouble getting LiveConnect to work properly with NN6+.
And there you have it.
;o)
V.V. -
Design Problem When SSIS Get String From Web to Do Fuzzy Lookup
Hi!
In my previous post Search Data by Fuzzy Lookup in Real Time
Scenario, I've tested required functions to build a sample website and SSIS, now it's time to polish my design. Since user will query a name from Web, SSIS is supposed to get a string to do
Fuzzy Lookup. I wonder how I can design to let fuzzy lookup consume String as input instead of a structure (like OLE DB, EXCEL, Flat File, etc ) .
Now I use table as datasource to do a fake input. The SQL_CMD variable will dynamically be replaced from Web input. It seems Fuzzy Lookup component needs a structure to be an input.
Do you have any design idea for my scenario ? Thank you!How are you executing the fuzzy lookup package ? Is it using command line or using asp.net code ?
In SSIS package we can create variables and assign any strings to these variables while running the ssis package in asp.net.
Refer
http://www.codeproject.com/Articles/28096/Excecute-SSIS-package-DTSX-from-ASP-Net
Also have you gone through SOUNDEX option of TSQL
http://www.tek-tips.com/faqs.cfm?fid=4110
Regards, RSingh -
Exception In getting Response from Databse ..
Hi friends,
I am getting a very unusual problem.I have a Webdynpro application which is using WebService Model.
It usually works fine, but whenever I am restarting the server. My application throws an null pointer exception, whenever there is a ejbFinder method call.
And when I stop and start the application again from Administrator Console, than again it starts working fine.
Kindly suggest me some way, So that i don't have to perform this activity again and again.
Thanks and Regards
Yajush MishraIt is likely your application is starting too quickly or has a soft dependency rather than a hard to something it needs. I would read up about these in the J2EE developers guide and put a dependency in your app to one of the last appications to start and that way it starts late in the deployment. You can see when apps start in the logviewer... I think it is the server log
-
Basic easy noob question - best way of getting string from slider value
Hi all
I'm using a slider in my iPhone app to allow the user to select the number of days on a scale 1 - 10 for example.
I've got the following which isn't quite working and after battling for hours and hours to get my head around UINavigationControllers I really can't be bothered anymore. Can someone please just give me the answer
I want to get an int value from the slider which returns a float. here's my code I have (which again, isn't working correctly).
-(IBAction)numberofDaysSliderMoved:(id)sender {
NSNumber *theValue = [NSNumber numberWithFloat:numberofDaysSlider.value];
[myLabel setText:[numberFormatter stringFromNumber:theValue]];
I know it's crap code and i've probably coded the long way round but i'm just trying to get it working and i'm new to obj-C so please bare with me.
Regards
WayneFirst off - you can wrap your code here like this:
my code here
<-- no slash
Here you go:
NSNumber *sliderValue = [NSNumber numberWithFloat:numberofDaysSlider.value];
int intValue = [sliderValue intValue];
NSString *stringValue = [sliderValue stringValue];
Have a look as the NSNumber docs. Lots of easy ways to create and convert numbers.
HTH -
How to get string from a stringBuider reference
Please see attached image.
How do I take the values from stringbuilder reference,into LabVIEW string?
(The DLL is C# and is proven)
Pls. help.
Attachments:
HowToMap_LV_String2StringBuilderReference.zip 43 KBJust connect the response element to an Invoke Node and select the ToString() method for the StringBuilder class.
-
Hello,
I want to get the path of the current file opened by Acrobat.In the function ACCB1 void ACCB2 MyAVDocWillOpenFromFile (ASPathName fileName, ASFileSys fileSys, void* clientData). Only get ASPathName ,how to convert it to C style string ?
Thanks!!Hi,
If you use the function, ASFileSysDIPathFromPath that should return a string you can use.
Normally you can call it like this, assuming all declarations are done.
myString = ASFileSysDIPathFromPath ( NULL, theASPathName, NULL);
HTH
Malky -
I have the following in an execute script. It creates an XML quite nicely. However, I need it to retrieve the data for comparison versus creating an XML. Is there an easy way to convert what I have so this can be accomplished? I need to compare the commonName to a string value that will be static, and store the userId that corresponds to it as a string.
DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
DocumentBuilder bd = fact.newDocumentBuilder();
Document doc = bd.newDocument();
Element root = (Element) doc.createElement("users");
doc.appendChild(root);
if(userlist != null)
Iterator iterator = userlist.iterator();
while ( iterator.hasNext() )
User eachUser = (User)iterator.next();
Element UserNode = doc.createElement("user");
Element ValueNode = doc.createElement("userID");
ValueNode.appendChild(doc.createTextNode(eachUser.userId));
UserNode.appendChild(ValueNode);
Element ValueNode = doc.createElement("commonName");
ValueNode.appendChild(doc.createTextNode(eachUser.commonName));
UserNode.appendChild(ValueNode);
root.appendChild(UserNode);
patExecContext.setProcessDataValue("/process_data/uXML", (Object)doc)I am not sure I follow.
The Execute Script service instance, above, creates the process variable "uXML" of type Object. Is the intent to iterate over "commonName" in "uXML" in a subsequent operation to determine the existence of the content of a second process variable containing the name?
Steve -
Get specific Strings from File
Good morning to every one.
I 've got a text file which contains a customer number and an order number, coded as we see in the picture below:
I am trying to develop a tool in Visual Studio, which it reads the file line-by-line and fills a listbox, with the order_number and the customer number. From the file above, I know that the order number are the digits on the first 'column' after the leading-zeros,
until '/', and the customer number are the digits without zeros in the 'third' column before 'CUSTOMER_NUMBER'. My form looks like:
The problem is, that the number of before the fields in file, are not equal in every line.
So, my question is how I can retrieve the 'order number' and 'customer number' from the text file and copy the results to list box, after clicking on 'Get Strings' button, like:
359962656 2238914
359562804 2238914
etc...
I attach my code here:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace ReadStringFileApp
public partial class frmMain : Form
public frmMain()
InitializeComponent();
OpenFileDialog openfile = new OpenFileDialog();
//openfiledialog to pickup filename
private void btnFindFile_Click(object sender, EventArgs e)
openfile.Filter = "Text|*.txt";
if (openfile.ShowDialog() == DialogResult.OK)
lbxResults.Items.Clear();
txtFilepath.Text = openfile.FileName.ToString();
//get strings from file
private void btnGetStrings_Click(object sender, EventArgs e)
//check if there is a file path on textbox
if (txtFilepath.Text == "")
MessageBox.Show("No File Select. Please select a file", "Error File Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
btnFindFile.Focus();
return;
//create list for all lines inside file
List<string> lines = new List<string>();
string line;
using (StreamReader r = new StreamReader(@txtFilepath.Text))
while ((line = r.ReadLine()) != null)
string ordernum;//string for order number
string customer;//string for customer number
//line = ordernum + "\t" + customer; //concatenate results to fill the list box
lbxResults.Items.Add(line);
r.Close(); //close file
private void btnExportToFIle_Click(object sender, EventArgs e)
//check if listbox is empty
if (lbxResults.Items.Count == 0)
MessageBox.Show("Result List is empty! Choose a file to proceed.", "Error Result List", MessageBoxButtons.OK, MessageBoxIcon.Error);
btnGetStrings.Focus();
return;
//read listbox contents and parse to a list object
List<string> list = new List<string>();
foreach (String i in lbxResults.Items)
list.Add(i);
//Create a file in c: with results
File.WriteAllLines(@"C:\export-test.txt", list, Encoding.Default);
MessageBox.Show("File export completed!", "File Export", MessageBoxButtons.OK, MessageBoxIcon.Information);
Thank you in advanced@ Joel Engineer
and@
Val10
I combined your responses and I get my results correctly. I attached the code I rewrite for further use:
private void btnGetStrings_Click(object sender, EventArgs e)
//check if there is a file path on textbox
if (txtFilepath.Text == "")
MessageBox.Show("No File Select. Please select a file", "Error File Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
btnFindFile.Focus();
return;
//create list for all lines inside file
List<string> lines = new List<string>();
string line;
using (StreamReader r = new StreamReader(@txtFilepath.Text))
while ((line = r.ReadLine()) != null)
string order_customer;
Regex reg = new Regex("0*");
//set an string array, to split the file in columns positions, defining the characters
string[] daneio = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
//get order number from the first column
var ordernum_zeros = reg.Match(daneio[0]).Value;
daneio[0] = daneio[0].Replace(ordernum_zeros, String.Empty);
daneio[0] = daneio[0].Substring(0, daneio[0].IndexOf("/"));
//get customer column, without zeros
var customer_zeros = reg.Match(daneio[5]).Value;
daneio[2] = daneio[2].Replace(customer_zeros, String.Empty);
daneio[2] = daneio[2].Substring(0, daneio[5].IndexOf("CUSTOMER_NUMBER"));
//combine the result in listbox
order_customer = daneio[0] + "\t" + daneio[2];
lbxResults.Items.Add(order_customer);
r.Close(); //close file
Thank you for your help! -
Getting String using ResourceBundle and XLIF resource bundle.
Hello,
I am using Jdev. 11.1.1.2.0. I am trying to use XLIFF resource bundle in the Model project and trying to get string from the bundle using following code. I am getting MissingResourceException. if I use Property Bundle, it works fine.
public String getMessage(String code)
return ResourceBundle.getBundle("model.ModelBundle").getString("MESSAGE1");
Any help to make it work with XLIFF resource bundle will be appreciated.
Thanks,
Amit
Edited by: Amit Patel on Apr 1, 2010 10:23 AMTo get the values from the resource bundle, you use the <fmt:message> tag
<fmt:message bundle="${appbundle}" key="lbl.accountnum"/> -
How to get string value from xml in JSF??
In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF
Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization. -
How to get string value from database table using Visual Studio 2005?
Hi,
Im developing plugin in illustrator cs3 using visual studio 2005. I need to get the values eneterd in database. Im able to get the integer values. But while getting string values it is returning empty value.
Im using the below code to get the values from database table
bool Table::Get(char* FieldName,int& FieldValue)
try
_variant_t vtValue;
vtValue = m_Rec->Fields->GetItem(FieldName)->GetValue();
FieldValue=vtValue.intVal;
CATCHERRGET
sprintf(m_ErrStr,"Success");
return 1;
Im using the below code to get the values.
AIErr getProjects()
char buf[5000];
int i;
std::string catName;
::CoInitialize(NULL);
Database db;
Table tbl;
errno_t err;
err = fopen(&file,"c:\\DBResult.txt","w");
fprintf(file, "Before Connection Established\n");
//MessageBox(NULL,CnnStr,"Connection String",0);
if(!db.Open(g->username,g->password,CnnStr))
db.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
fprintf(file, "After Connection Established\n");
if(!db.Execute("select ProjectID,ProjectName from projectsample",tbl))
db.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
int ProjectID;
int UserID;
int ProjectTitle;
char ProjectName[ProjectNameSize];
if(!tbl.ISEOF())
tbl.MoveFirst();
ProjectArrCnt=0;
for(i=0;i<128;i++)
buf[i]='\0';
int j=0;
while(!tbl.ISEOF())
if(tbl.Get("ProjectID",ProjectID))
fprintf(file,"Project ID: %d ",ProjectID);
ProjectInfo[ProjectArrCnt].ProjectID = ProjectID;
sprintf(buf,"%d",ProjectID);
//MessageBox(NULL, buf,"f ID", 0);
j++;
else
tbl.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
break;
//if(tbl.Get("ProjectTitle",ProjectName))
if(tbl.Get("ProjectName",ProjectName))
MessageBox(NULL,"Inside","",0);
fprintf(file,"ProjectTitle: %s\n",ProjectName);
//catName=CategoryName;
ProjectInfo[ProjectArrCnt].ProjectName=ProjectName;
//sprintf(buf,"%s",ProjectName);
MessageBox(NULL,(LPCSTR)ProjectName,"",0);
else
tbl.GetErrorErrStr(ErrStr);
fprintf(file,"Error: %s\n",ErrStr);
break;
ProjectArrCnt++;
//MessageBox(NULL, "While", "WIN API Test",0);
tbl.MoveNext();
//MessageBox(NULL, ProjectInfo[i].ProjectName.c_str(),"f Name", 0);
::CoUninitialize();
//sprintf(buf,"%s",file);
//MessageBox(NULL,buf,"File",0);
fprintf(file, "Connection closed\n");
fclose(file);
for(i=0;i<ProjectArrCnt;i++)
sprintf(buf,"%i",ProjectInfo[i].ProjectID);
//MessageBox(NULL,buf,"Proj ID",0);
//MessageBox(NULL,ProjectInfo[i].ProjectName.c_str(),"Project Name",0);
return 0;
In the above code im geeting project D which is an integer value. But not able to get the project name.
Please some one guide me.As I said in the other thread, this really isn't the place to ask questions about a database API unrelated to the Illustrator SDK. You're far more like to find people familliar with your problem on a forum that is dedicated to answering those kinds of questions instead.
-
Use a String to get data from a variable?
Hi, I've got a major problem, I need to get data (int []) from a variable, using a String with the name of the variable..
Does anyone know if this is possible?
public class Commands {
private static final int[] deploy_1 = {64,37,73,1};
private static final int[] deploy_2 = {4,167,6,51};
/** Creates a new instance of Commands */
public Commands() {
public int[] get(String name)
// what code here?
}I should be getting the data with
int[] command = Commands.get("deploy_1");
or something like that...
Please help me!
FYI, a hashtable is not a option!
Many thanks, Vikkojava.lang.NoSuchFieldException: deploy_1
at java.lang.Class.getField(Class.java:1507)
at dumb_commandstest.Commands.get(Commands.java:30)
at dumb_commandstest.Main.getData(Main.java:36)
at dumb_commandstest.Main.<init>(Main.java:21)
at dumb_commandstest.Main.main(Main.java:28)
Any ideas why I get a NoSuchFieldException?
deploy_1 does exist.
Maybe you are looking for
-
S_P00_07000139 Amount is showing '0'
Dear Sir, i am using this community network first time i want to know the SAP standard report tocde S_P00_07000139 when we executing then in Amount colomn its showing zero see the attached sheet or below screen shot. Material no. : 11001776 MX435
-
How to create hyperlink in PDF?
how do i create a live link in a pdf using Acrobat XI Pro?
-
May be to complex for project 2010
Hello, My company recently purchased Microsoft project 2010 to track current jobs. We are becoming a large land surveying company with very large contracts. Each job could last a year or more and have about 12 task during that duration. Between each
-
Can anyone explain how Exchange Push works?
I was wondering if anyone could explain how the exchange server push is working. We recently picked up an iPhone to test with our small business and we noticed that it states it is using push information for exchange. However all of our other phones
-
Sun C++ std::sort coredump during sorting array of long values
Hello, I got core dump during execution following test program on both Solaris 9 (compile by CC: Sun C++ 5.5 Patch 113817-19 2006/10/13) and Solaris 10 platforms (compile by CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25). Core is dumped duri