Hi, i need a help with my code.
(1) - i am connecting to database
(2) - reading column
(3) - I want to capture all data (rows) into a string
(4) - Pass into a function --> ItemData data = new ItemData(TransactionList);
HOW DO I APPEND ROWS INTO A STRING? --> i am able to do that by using += but i am getting "null" char which i do not want. please help.
Thanks.
so here is short code... let me know if you need more then this i will post it.
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String url = "jdbc:oracle:thin:@prophet.njit.edu:1521:cours e";
String url1 = System.getProperty("JDBC_URL");
if (url1 != null)
url = url1;
Connection conn = DriverManager.getConnection (url, "ynp2", "Baroda19");
Statement stmt = conn.createStatement ();
// Select the SYSDATE column from the dual table
ResultSet rset = stmt.executeQuery ("select * from HD");
Output.setText("Connection.." + "\n");
// Print the result
//int no=0;
while (rset.next ())
{
if (rset.getString(2) != null)
{
TransactionList = "\n";
TransactionList += rset.getString(2).trim();
}
}
Output.setText(TransactionList + "\n");
ItemData data = new ItemData(TransactionList);