aspose file tools*
The moose likes Beginning Java and the fly likes Need to pass information from MS Access database to another program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need to pass information from MS Access database to another program" Watch "Need to pass information from MS Access database to another program" New topic
Author

Need to pass information from MS Access database to another program

aristal wang
Greenhorn

Joined: Dec 23, 2006
Posts: 14
Hi,

I really need some help here...

I need to pass selected information from my database to another information.

I am able to select and display the infotmation but i am not sure how i can transfer the information to the next program. Can any one please offer me some assistance?

My code is as follow:
/* Getting data from PSM32 and displaying it *can work* */

import java.net.URL;
import java.sql.*;
import java.lang.String;

/** Application to create a Ganttchart * */

public class PSMdb
{

public static void main (String argv[])
{

//SQLQueryFormat a = new SQLQueryFormat();
System.out.println("\nEstablishing Connection - Pls Wait... \n");

/** Get Info fr database**/
try
{
//Connect to the database specified in the URL
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc SM32");
System.out.println("Connection Established.\n");

//Create a SELECT statement object
Statement statmt = con.createStatement();

//Issue the SELECT statement
String querySt = "SELECT Set, Name, Order " +
"FROM PMETERS " +
"WHERE Set = 'BRAKE.BAK' ";

//Create and execute query
ResultSet res = statmt.executeQuery(querySt);


while (res.next())
{
String Proj = res.getString(1); //get Proj Name
String Task = res.getString(2); //get Task Name

//Print statement
System.out.println("" +Proj);
System.out.println("" +Task);

}

//Close Statement and Connection
statmt.close();
con.close();
System.out.println("\nConnection Closed - Operation Successful.");
}

catch(Exception E)
{
//Print out the Exception Error
System.out.println("Error:" +E );
}
}
}

And yes there is another problem. I can compile and run the program in a C:\folder but when i open the document in a project workspace, i cant compile the above code. Can any one please offer me assistance?

Thanks a million.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
It seems that you know how to get data out of Access. To advise how to transfer data to the next program we'd need to know how that program takes its input.

You don't say why you can't compile the program, so we can't help with that. Are there compile errors? If so, post them along with the lines in which they occur.
[ January 11, 2007: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
aristal wang
Greenhorn

Joined: Dec 23, 2006
Posts: 14
Thanks for responding. =p

"To advise how to transfer data to the next program we'd need to know how that program takes its input."

the program is a java applet that that is supposed to retrive the events in the "task" field and display it in a applet. It uses the jfree lib functions.

the code for the applet is as follow



And for the runtime error in the database program which i wrote is
"java.lang.NoSuchMethodError: main
Exception in thread "main" "


I would really appreciate if leads on how can i proceed is given to me.

Thanks
aristal wang
Greenhorn

Joined: Dec 23, 2006
Posts: 14
erm is there any1 that can help this old folk here whos not getting much progress??

thanks a lot
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42276
    
  64
"NoSuchMethodError: main" means that you're apparently trying to run this class as if it was an application, by using the "java" command. But this is not an application - it is an applet, and applets are run by embedding them in an HTML page via an APPLET tag.

You can make this code runnable as an application either by adding a main method, or by using the MainFrame class. Or you can keep it an applet and include it in a web page.
[ January 14, 2007: Message edited by: Ulf Dittmer ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need to pass information from MS Access database to another program