problems with body text

hi

i want to send data form the database - only the data from the column "answer" where the UT_UID="1"

so i think that my sql query should be ok

but the problem seemt to be how I do the saving into the results set....

PLEASE!!!! can you have a look on it and help me... i have to finish it in 2 hours :(

here ist the code

package coreservlets;

import java.util.*;

import javax.mail.*;

import javax.mail.internet.*;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.ResultSetMetaData;

import java.sql.SQLException;

import java.sql.Statement;

publicclass MailBean{

private String mailaddress;

public String getMailaddress(){

return(mailaddress);

}

public String sendMail(){

Properties props =new Properties();

props.put("mail.smtp.host","mail.xxxx");

Session s = Session.getInstance(props,null);

MimeMessage message =new MimeMessage(s);

InternetAddress from =null;

try{

from =new InternetAddress("xxx@xxxx");

}catch (AddressException e){

// TODO Auto-generated catch block

e.printStackTrace();

}

try{

message.setFrom(from);

}catch (MessagingException e){

// TODO Auto-generated catch block

e.printStackTrace();

}

InternetAddress to =null;

try{

to =new InternetAddress(getMailaddress());

}catch (AddressException e){

// TODO Auto-generated catch block

e.printStackTrace();

}

try{

message.addRecipient(Message.RecipientType.TO, to);

}catch (MessagingException e){

// TODO Auto-generated catch block

e.printStackTrace();

}

try{

message.setSubject("something");

}catch (MessagingException e){

// TODO Auto-generated catch block

e.printStackTrace();

}

try{

//BodyText

try{

Class.forName("com.mysql.jdbc.Driver" );//( "org.gjt.mm.mysql.Driver");

Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/imac","user","password");

try{

Statement stmt = con.createStatement();

//鋘dern auf UT_UID='"+getUT_UID"+"'"

ResultSet rs = stmt.executeQuery("SELECT (answer) FROM answers WHERE UT_UID='1'");

rs = stmt.getResultSet();

ResultSetMetaData rsmd = rs.getMetaData();

int max = rsmd.getRowCount();

for (int i = 1; i <= max; i++)

while(rs.next()){

message.setText("Your Data: " + i+" " +rsmd.getRowName(i));

}

}finally{

con.close();

}

}catch (ClassNotFoundException e){

// TODO: handle exception here

returnnull;// stay on the same page

}catch (SQLException e){

// TODO: handle exception here

returnnull;// stay on the same page

}

//BodyText Ende

}catch (MessagingException e){

// TODO Auto-generated catch block

e.printStackTrace();

}

try{

Transport.send(message);

}catch (MessagingException e){

// TODO Auto-generated catch block

e.printStackTrace();

}

return ("mailsuccess");

}

}

[6959 byte] By [klammera] at [2007-10-2 4:45:23]
# 1
i changed the Row to Columnbut it does not change something
klammera at 2007-7-16 0:50:15 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...