Help with Retrieve attributes from database
Hi,
I'm using filter "Retrieve from or write to database" with select query from database by selecting attributes as column names radio button.
I'm unable to get these user attributes with column names.
For eg : select tag from test_tag where rownum=1;
I was trying so that result can be used using tag attribute (${tag}).
Please help in this regard.
Thanks,
Vani
Hi Vani,
After the retrieve filter, add a Trace Filter and leave it as it is. Execute the policy once and in the trace data that now will be displayed there you should be able to read out the exact name and type of the parameter. This way of identifying data/parameters etc is a recommended way of working while developing! Copy paste the Trace Data from the Trace filter here if you need help!
Cheers,
Stefan
Similar Messages
-
Need help in retrieving attributes from LDAP using JNDI
I am trying to retrieve attributes from LDAP using JNDI, but I'm getting the following error when I try to run my Java program.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/naming/NamingException
I have all the jar files in my classpath: j2ee.jar, fscontext.jar and providerutil.jar. The interesting thing is that it gets compiled just fine but gives an error at run-time.
Could anyone tell me why I'm getting this error? Thanks!
Here's my code:
import javax.naming.*;
import javax.naming.directory.*;
import java.util.*;
import java.io.*;
class Getattr {
public static void main(String[] args) {
// Identify service provider to use
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
// user info
String userName = "username";
String password = "password";
// LDAP server specific information
String host = "ldaphostname";
String port = "portnumber";
String basedn = "o=organization,c=country";
String userdn = "cn=" + userName + "," + basedn;
env.put(Context.PROVIDER_URL, "ldap://" + host + ":" + port + "/" + basedn);
env.put(Context.SECURITY_PRINCIPAL, userdn);
env.put(Context.SECURITY_CREDENTIALS, password);
try {
System.setErr(new PrintStream(new FileOutputStream(new File("data.txt"))));
// Create the initial directory context
DirContext ctx = new InitialDirContext(env);
// Ask for all attributes of the object
Attributes attrs = ctx.getAttributes("cn=" + userName);
NamingEnumeration ne = attrs.getAll();
while(ne.hasMore()){
Attribute attr = (Attribute) ne.next();
if(attr.size() > 1){
for(Enumeration e = attr.getAll(); e.hasMoreElements() ;) {
System.err.println(attr.getID() + ": " + e.nextElement());
} else {
System.err.println(attr.getID() + ": " + attr.get());
// Close the context when we're done
ctx.close();
} catch(javax.naming.NamingException ne) {
System.err.println("Naming Exception: " + ne);
} catch(IOException ioe) {
System.err.println("IO Exception: " + ioe);That doesn't work either. It seems its not finding the NamingException class in any of the jar files. I don't know why? Any clues?
-
Help with ComboBox, datasource from database
Hi there,
i am new to Flex technology and desperately need help with
combobox.
I have a combobox in my app and the datasource comes from
MySQL database. I use a PHP script to populate the combobox. Say in
the datatabse table, I have the following result:
id name
1 dog
2 cat
3 horse
In the app, the combobox will have the list as the name of
the animals: dog, cat, horse. But when the user selects dog, how do
I get the selected id 1 instead of the label "dog".
Any help/suggestion will be appreciated.Hi again,
the xml for the combobox datasource is as follows
<animals>
<animal>
<id>1</id>
<name>dog</name>
</animal>
<animal>
<id>2</id>
<name>cat</name>
</animal>
<animal>
<id>3</id>
<name>horse</name>
</animal>
</animals>
and my <mx:HTTPService> is:
<mx:HTTPService id="dropDown" useProxy="false" url="
http://localhost/~ronnyk/combobox.php"
resultFormat="e4x" result="get_drop_down(event)" />
public function get_drop_down(e:ResultEvent):void{
var dropArr:XML = e.result as XML;
cb.dataProvider = dropArr.animal;
cb.labelField = "name";
cb.data = "id";
public function clickme():void{
txtinput.text = cb.selectedItem as String;
I can't figure out which part I did wrong, in order to get
the id instead of the name when the user clicks the button -
Help with retrieving emails from Gmail into Mail
Help! I'm helping my mom with her computer and her hard drive died (not backed up of course). She has a new hard drive now and I am importing her emails from her Gmail account into Mail. It worked great importing all the emails that she has since July 15th (the last time she retrieved mail from her Gmail account). If I go into Gmail through Safari I can she has hundreds more emails prior to this date still on their servers but they didn't download into Mail. I presume this is because Gmail knows they have been downloaded once before (to her old dead hard drive), but how do I get around this so all of her emails can be imported into Mail? The only copies are on the Gmail servers.
Thanks in advance for your help,
ScottOkay, then let's try this:
1. Quit Mail.
2. Go to Home/Library/Mail and remove (don't copy and don't empty the Trash) the POP mailbox.
3. Go to Home/Library/Preferences and remove the com.apple.mail.plist file.
4. Restart Mail, setup your POP account again and it should connect to Gmail and download all the messages. If it does, then you can delete the file and folder you previously removed. -
Need help in retrieving data from database table
Hi ,
I have a Ztable with primary key.The table gets automatically sorted on primary key
But I want to retrieve the ztable data in the order in which i enter data in to table.
EXAMPLE :
I enter data as : mydata
action
welcome
When i retrieve this data internal table should be filled in the same order.
Your inputs will be very helpful.
Thanks in advance.You will need to change your table to use a number as the first key field (after the client) which you increase by 1 each time you make a new entry. Alternatively you can add a data/time stamp to the end of your table and use this to sort your internal table once you've extracted the records.
Regards,
Nick -
Please help with retrieving values from object stored in a vector
hi..
i have a class Magazine with 2 varibles name and price like this
class magazine
String name;
int price;
i have created a vector called selectedmag which stores objects of Magazine class... now each object will contain the name and price rite...
i want to print the values stored in vector ie i want to print the vector elements...like
Name: Mag1
Price: 10
which wil be present in object1...
and then
Name: Mag2
Price:15
which wil be present in object2...
and so on...
plz help...
if i give selectedmag.elementAt(position) i am not able to get the above output...plz help me.....
thanks,
Akshathahi,
Yes i have used a for loop to print the values... it goes like this
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
class Magazine
String title;
int price;
public class sessiontrack1 extends HttpServlet
public void doPost(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
res.setContentType("text/html");
PrintWriter out=res.getWriter();
HttpSession session=req.getSession(true);
// This is my vector
Vector myshoppingcart=(Vector)session.getAttribute("ShoppingCart");
if(myshoppingcart==null)
myshoppingcart=new Vector();
Magazine selectedMag=new Magazine();
selectedMag.title=req.getParameter("Title");
selectedMag.price=Integer.parseInt(req.getParameter("Price"));
//Putting Magazine object into the vector myshoppingcart
myshoppingcart.addElement(selectedMag);
session.setAttribute("ShoppingCart",myshoppingcart);
out.println("<html><body>U have selected these magazines");
out.println("<br>");
//Enumeration vEnum=myshoppincart.elements();
//here a am trying to print output the values
for(int i=0;i<myshoppingcart.size();i++)
out.println("Name:" + (Magazine)myshoppingcart.elementAt(i));
out.println("<br>");
out.println("Price:" + (Magazine)myshoppingcart.elementAt(i));
out.println("<br>");
out.println("</body></html>");
this is a servlet program.... plz suggest me how to print the values... in the following format
Name: Book1
price: Rs 10
Name:Book2
price:Rs 15
Akshatha -
Help with displaying info from database+asp
How can I display info from a database so that it is
formatted into rows in a table
here is an example of what I would like
http://www.westerveltcollege.com/new/programs/bus_admin_computers.html
(it is the section that show the course content)
I know it has been code into the table but how to do this
dymanically
hope that makes sense to someone ;)To do it properly you would set up two tables. The first
would contain the
topics and be something like this
topicID
topicName
Then you would have a second table that would hold the
content like this
contentID
contentName
topicID
The last field links this table to the topic.
To display them you would link the topics into a master list,
and then pass
the topicID to the page displaying the content and use the
topicID as a
filter on the content table.
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"jnc1965" <[email protected]> wrote in
message
news:eeot1q$db0$[email protected]..
> nice one thanks
>
> now one more quetion
> how do I set up the info in the database
> I have serveral page for different topics and each page
has a table like
> mentioned above
> I dont want to make a different colunm for each for the
course contents
> I would like to build one table and have each subject's
course content in
> a
> column but how would I do this?
> and still have appear like the example
> -
Help with dynamic checkbox from database results
Hi,
I am creating some dynamic checkboxes from the results of a database read to sqlite. I am able to get the data and the correct number of checkboxes is being created but I'm having a problem populating the labels for the checkboxes. Here is the section of code that gets the results from the database and creates the checkboxes.
var result:Array = stmt.getResult().data;
for each( var obj:Object in result )
var cb:CheckBox = new CheckBox();
cb.label = obj.toString();
cb.setStyle("color", 0x00593B);
cb.setStyle("symbolColor", 0x000000);
container.contentGroup.addElement(cb);
NeilThis was answered on another forum for me.
The line cb.label = obj.toString();
needed to be changed to the data.
cb.label=obj.myDatabaseFieldName;
myDatabaseFieldName would be whatever column you are pulling the data in from and should be the actual name in the table.
Neil -
Retrieving Data from database to combobox
Hi
Can anyone help in retrieving data from database to combobox..
All the names of employees and their designations are stored in database.so i want retrieve them in other page.
both designation and names of employees are comboboxes.
after loading tha page i need to get all the designations which are stored in database in first combobox and when i select a particular designation i need get all tha names of employees of that designation in other combobox.this has to be done using jsp and ajax.
please can anyone give me the code for this using Ajax and Jsp.Hello Friend try this code
dbdata.jsp
<%@page language="java" import="java.sql.*"%>
<html>
<%
Class.forName("..........");
Connection n=DriverManager.getConnection ("....","...","...");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select ename from emp");
%>
<body>
<form>
<select>
<%
while(rs.next())
%>
<option><%=rs.getString("ename")%></option>
<%
%>
</select>
</form>
</body>
</html> -
WPF- How to save and retrieve details from database
I want to develop an desktop app to save and retrieve details from database, but am having a little hitch
am getting errors in my code, kindly advice below are the required code
xaml
<Grid>
<TextBox HorizontalAlignment="Left" Height="23" Margin="144,28,0,0" TextWrapping="Wrap" x:Name="TbxId" VerticalAlignment="Top" Width="193"/>
<TextBox HorizontalAlignment="Left" Height="23" Margin="144,134,0,0" TextWrapping="Wrap" x:Name="TbxFn" VerticalAlignment="Top" Width="193"/>
<TextBox HorizontalAlignment="Left" Height="23" Margin="144,77,0,0" TextWrapping="Wrap" x:Name="TbxLn" VerticalAlignment="Top" Width="193"/>
<Label Content="Student ID" HorizontalAlignment="Left" Margin="10,28,0,0" VerticalAlignment="Top" Width="101"/>
<Label Content="Last Name" HorizontalAlignment="Left" Margin="10,134,0,0" VerticalAlignment="Top" Width="101"/>
<Label Content="First Name" HorizontalAlignment="Left" Margin="10,77,0,0" VerticalAlignment="Top" Width="101"/>
<Button x:Name="BtnSave" Content="Save" HorizontalAlignment="Left" Margin="23,206,0,0" VerticalAlignment="Top" Width="75" />
<Button x:Name="BtnBrowse" Content="Browse" HorizontalAlignment="Left" Margin="149,206,0,0" VerticalAlignment="Top" Width="75" Click="Save"/>
<Button x:Name="BtnShow" Content="Show" HorizontalAlignment="Left" Margin="294,206,0,0" VerticalAlignment="Top" Width="75"/>
<WindowsFormsHost Grid.Column="0" Margin="448,28,75,243">
<wf:PictureBox x:Name="pictureBox1" Height="150" Width="150" SizeMode="StretchImage"/>
</WindowsFormsHost>
</Grid>
cs
private void Browse(object sender, RoutedEventArgs e)
SqlConnection cn = SqlConnection(global::DatabaseApp.Properties.Settings.Default.Database1ConnectionString);
try
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif|All Files(*.*)|*.*";
dlg.Title = "Select Student Picture";
if (dlg.ShowDialog() == DialogResult.OK)
imgLoc = dlg.FileName.ToString();
picStu.ImageLocation = imgLoc;
catch(Exception ex)
System.Windows.MessageBox.Show(ex.Message);
Thank you
Jayjay johnHi Joakins,
I think Lloyd has a point here in that all I see there which is really database related is a connection string.
Maybe your question is more general though and you're just asking how to work with a database as a general principle.
Personally, I like entity framework and would recommend that.
You can read a shed load of stuff about it.
https://msdn.microsoft.com/en-gb/data/ef.aspx?f=255&MSPPError=-2147217396
With WPF almost every dev uses MVVM and I'm no exception.
You may find this interesting:
http://social.technet.microsoft.com/wiki/contents/articles/28209.wpf-entity-framework-mvvm-walk-through-1.aspx
The article for the second in the series is only partly written, but the sample is complete:
https://gallery.technet.microsoft.com/WPF-Entity-Framework-MVVM-78cdc204
Hope that helps.
Recent Technet articles: Property List Editing;
Dynamic XAML -
Problems with retrieving data from tables with 240 and more records
Hi,
I've been connecting to Oracle 11g Server (not sure exact version) using Oracle 10.1.0 Client and O10 Oracle 10g driver. Everything was ok.
I installed Oracle 11.2.0 Client and I started to have problems with retrieving data from tables.
First I used the same connection string, driver and so on (O10 Oracle 10g) then I tried ORA Oracle but with no luck. The result is like this:
I'm able to connect to database. I'm able to retrieve data but from small tables (e.g. with 110 records it works perfectly using both O10 and ORA drivers). When I try to retrieve data from tables with like 240 and more records retrieval simply hangs (nothing happens at all - no error, no timeout). Application seems to hang forever.
I'm using Powerbuilder to connect to Database (either PB10.5 using O10 driver or PB12 using ORA driver). I used DBTrace, so I see that query hangs on the first FETCH.
So for the retrievals that hang I have something like:
(3260008): BIND SELECT OUTPUT BUFFER (DataWindow):(DBI_SELBIND) (0.186 MS / 18978.709 MS)
(3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=0
(3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=1
(3260008): ,len=160,type=DECIMAL,pbt=4,dbt=0,ct=0,prec=0,scale=0
(3260008): EXECUTE:(DBI_DW_EXECUTE) (192.982 MS / 19171.691 MS)
(3260008): FETCH NEXT:(DBI_FETCHNEXT)
and this is the last line,
while for retrievals that end, I have FETCH producing time, data in buffer and moving to the next Fetch until all data is retrieved
On the side note, I have no problems with retrieving data either by SQL Developer or DbVisualizer.
Problems started when I installed 11.2.0 Client. Even if I want to use 10.0.1 Client, the same problem occurs. So I guess something from 11.2.0 overrides 10.0.1 settings.
I will appreciate any comments/hints/help.
Thank you very much.pgoel wrote:
I've been connecting to Oracle 11g Server (not sure exact version) using Oracle 10.1.0 Client and O10 Oracle 10g driver. Everything was ok.Earlier (before installing new stuff) did you ever try retrieving data from big tables (like 240 and more records), if yes, was it working?Yes, with Oracle 10g client (before installing 11g) I was able to retrieve any data, either it was 10k+ records or 100 records. Installing 11g client changed something that even using old 10g client (which I still have installed) fails to work. The same problem occur no matter I'm using 10g or 11g client now. Powerbuilder hangs on retrieving tables with more than like 240 records.
Thanks. -
Get username from session and retrieve records from database wit tat userna
hello..
i got a ChangePassword.jsp which i retrieve the username from session using bean to display on e page..
<jsp:getProperty name="UsernamePassword" property = "username"/>
but in my servlet, i wan to retrieve records from database with tat username..
i tot of coding
String username = (String)request.getSession().getAttribute("UsernamePassword");
and then use tat username to retrieve records.. but is that e right way? The page did not display and i got a CastingException..
Please help.If you are using the session inside a jsp, you can say "session" without having to declare it.String usernamePassword = (String) session.getAttribute("usernamePassword");However, right after you get this value, check if it is null:
if(usernamePassword==null)
// do sth like forward to error page
else
// continue processing
If it is null, then you are probably not setting it right in the first place. Make sure that in your servlet A you create a session, and before you return or forward to a jsp, that you actually set this value in the session like saying
session.setAttribute("usernamePassword", usernamePassword);
and it is case sensitive for the key. -
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. -
How to retrieve data from database to the structure(complicated)
Hello everyone:
I want to retrieve data from database to the structure. but the structure defined like this below:
TOLERANZOB LIKE QAMV-TOLERANZOB
TOLERANZOB1 LIKE QAMV-TOLERANZOB
so how can I retrieve the data from the database ? make sure that the two fields contain data both.
Thanks in advance .
Regards
NickHi Nick,
To retreive data for TOLERANZOB from QAMV,
If you know the key fields then use
SELECT SINGLE TOLERANZOB FROM QAMV INTO TOLERANZOB WHERE keyfields.
else, you can use
SELECT TOLERANZOB FROM QAMV UPTO ONE ROWS INTO TOLERANZOB WHERE....
Once you retreive the data using the select query, you can check if it is initial and if not move the data from TOLERANZOB to TOLERANZOB1.
<b>Reward points for helpful answers.</b>
Best Regards,
Ram. -
I am facing a Problem with reading images from database
Hi everybody..
any help will be most appreciated, I am facing problem with reading images from database. I am pasting my code...
string connect = "datasource = localhost; port = 3306; username = root; password = ;";
MySqlConnection conn = new MySqlConnection(connect); // creating connecting string
MySqlCommand sda = new MySqlCommand(@"select * from management.add_products ", conn); //creating query
MySqlDataReader reader;
try
conn.Open(); // Opening Connection
reader = sda.ExecuteReader(); // Executing my Query..
while (reader.Read())
byte[] imgg = (byte[])(reader["Picture"]);
if (imgg == null)
pc1.Image = null;
else
MemoryStream mstream = new MemoryStream(imgg);
pc1.Image = System.Drawing.Image.FromStream(mstream);
It says Parameter not Valid... i am reading all the images from databaseI agree with Viorel. You are getting the error because the format of the data is incorrect probably because the data was modify. It may not be the reading of the database the is incorrect, but the application that wrote the data into the database. You need
to compare the imgg array data with the data before it was written to the database to see if the data matches. I usually start by comparing the number of bytes which is easier to check then compare the actual to isolate which function is changing the
byte count.
An image is binary data. The standard VS methods for reading and writing data (usually stream classes) default to ASCII encoding which will corrupt binary data. The solution usually is to use UTF8 encoding instead of the default ascii encoding.
Ascii encoding with stream often aligns the data and adds extra null bytes to the end of the data which can produce these type errors.
jdweng
Maybe you are looking for
-
How to filter the list of data
I am using af:inputComboboxListOfValues to display drop down list of data. The list is binded to a LOV. I have a requirement that if the value is used in other place, I should not get it listed on the drop down list. I research doc that it let me use
-
Flex Mobile List view only displaying correctly in debug build
I've got a horizontal list view that I've created in my app. There is a button that changes it's layout and items between a small thumbnail grid layoutand a larger thumbnail single row layout. In my debug build, this works just fine every single time
-
How to cache the data of a view?
Hi all, I have problem on saving the data of a view object. Basiclly, I have a View1 which takes long time to generate from database, then I will do some query(max, group by, etc) over View1 to generate View2 multiple times based on different paramet
-
Hi, I give up. I want to follow this procedure as found on the HP website: HP Printers - Using ICC Profiles for Color Photos in Adobe Photoshop. However, after two days of searching I have been unable to locate the HP ICC profiles for my printer, pa
-
Hello, I have downloaded a live tv app and have picture but no sound on this particular app. Any ideas?