Send a ResultSet object via RMI - won't work.

Hi. I make a user interface to access MySQL database. The access to MySQL server is done from a remote location via RMI. The process to delete/update/create was succeed. The only problem is when I try to get(from the client computer) the ResultSet object, that come from invoking statementObject.executeQuery(myQuery) method, from the server Computer: it won't work. It said that the ResultSet object is not serialized(it is an interface). I need the ResultSet object for my client program since I will use it to set my AbstractTableModel class's object. Last goal is to put the AbstractTableModel object into the JTable constructor so I can see the result from a table.
Is anyone can help me? I can not return the ResultSet object to the client since it is not serialized.

I use the following solution using List. As List is Serlizable I can throw it across the network using RMI... it is also of course easy to access.......
For users objects you need to throw across the network just simply make them implement Serializable
In your ORM class accessing the DB:
public List getSQLResults{
Resultset SQLResults = statement.executeQuery(SQLQuery);
Vector results = new Vector();
while (SQLResults.next()){
// create class object here if needed...
results.add(SQLResults.getStrinf("COL_NAME");
return results;In your GUI class..
JTable theTable = new JTable();
DefaultTableModel theModel = new DefaultTableModel();
theModel.addColumn(SOME_COLUMN);
try{
List resultsData = ORMClass.getSQLResults();
Iterator iterator = List.Iterator();
while(iterator.hasNext()){
iterator.next();
theTableModel.addRow(SOME_OBJECT);
theTable.setModel(theModel);
catch(Exception ex){
// exception rasied...... do something!!!
}

Similar Messages

  • How can I copy my music files to my iPAD. The CDs are currently stored in folders on my PC. Note: Synching via iCLOUD won't work because I have VISTA OS and I need at least Windows 7 or 8.

    How can I copy my music files to my iPAD. The CDs are currently stored in folders on my PC. Note: Synching via iCLOUD won't work because I have VISTA OS and I need at least Windows 7 or 8.

    Hi ladextr,
    Thanks for using Apple Support Communities.  To sync your music to your iPad, first put your music in iTunes as described here:
    Adding music and other content to iTunes
    http://support.apple.com/kb/ht1473
    Adding content on your computer to iTunes
    iTunes helps you add digital audio and video files on your computer directly to your iTunes library. You can add audio files that are in AAC, MP3, WAV, AIFF, Apple Lossless, or Audible.com (.aa) format. If you have unprotected WMA content, iTunes for Windows can convert these files to one of these formats. You can also add video content in QuickTime or MPEG-4 format to iTunes. To learn how to add these files to iTunes follow the steps below.
    Open iTunes
    From the File menu, choose one of the following choices:
    MacAdd to Library
    Windows
    Add File to Library
    Add Folder to Library
    Navigate to and select the file or folder that you want to add
    If iTunes is set to "Copy files to the iTunes Music folder when adding to library," iTunes will copy all content that is added to the iTunes library to the iTunes Music folder. To adjust this setting or change the location of this folder, go to the Advanced tab in iTunes Preferences.
    Once that's done, you can sync the music to your iPad by following this article:
    iTunes 11 for Windows: Set up syncing for iPod, iPhone, or iPad
    http://support.apple.com/kb/ph12313
    Cheers,
    - Ari

  • Getting RuntimeException while sending a JMenu Object via http

    Hello,
    since Java 1.5.0 i use a mechanism, which transfers a JMenu from my servlet object to my applet object via http.
    Now since 1.5.0_02 i get this Exception while doing it:
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.swing)
    Now there is nothing to find about this. Not here in the forums, neither in google or anywhere else.
    My guess is, its a matter of deserialization of thoses Jmenus.
    Anybody out there with the same problem?
    Anybody knows how to solve this WITHOUT changes the policy?
    thanks
    steffan

    The directory that contains msgsend.class (usually the current directory)
    is not in your CLASSPATH setting. Be sure that "." is included as one of the
    entries in CLASSPATH.

  • Sending an InetAddress-object via udp

    hi there!
    i'm developing a videostream server/client application. client is an applet. what i want to do is this:
    since an applet has to be signed in order to perform dns-lookups, i want to work around that.
    since the applet has to request the stream anyway and therefore connects the server sending udp-
    packets, my idea was to let the server send back the clients IP/hostname as an InetAddress-object
    inside a udp packet.
    i tried the following:
    info: byte[] buf = new byte[256];
    on server:
    InetAddress address = packet.getAddress();
    buf = address.getAddress();
    packet = new DatagramPacket(buf, buf.length, address, port);
    socket.send(packet);
    on client:
    socket.receive(packet);
    byte[] temp = packet.getData();
    source = InetAddress.getByAddress(temp);
    System.out.println(source.toString());
    the system.out returns this: ı�A)
    or other unreadable stuff, depending on the ip-address of the client.
    i think, this has something to do with the conversion to/from bytearray, doesn't it?
    can anyone show me how to send an InetAddress-object so that i get an
    InetAddress-object out at the client side?
    thanks in advance!
    you can earn some bucks, too!
    greets
    honfrek

    hi there!
    thanks for your help. i got it figured out now.
    now it works like this:
    on server:
    InetAddress address = packet.getAddress();
    buf = address.getAddress();
    byte[] newbuf = new byte[buf.length];
    newbuf = buf;
    packet = new DatagramPacket(newbuf, newbuf.length, address, port);
    socket.send(packet);
    on client:
    byte[] newbuf = new byte[4];
    packet = new DatagramPacket(newbuf,newbuf.length);
    socket.receive(packet);
    source = InetAddress.getByAddress(packet.getData());
    i made 2 mistakes:
    - i converted the InetAddress to a string
    - the length of the byte[] was too big. i had a bunch of zeroes at the end

  • How to send a Connection Object via CORBA

    Hi.
    I've got a question.
    How can I send a java.sql.Connection object
    using CORBA to a client? Tried to use a class
    MyConnection extending org.omg.CORBA.portable.ObjectImpl
    as a wrapper class. Didn't work.
    When a request was invoked for a Connection,
    no object was send. On client side an error occured:
    code 202 completed:maybe.
    In the IDL we used:
         typedef Object MyConnection;
         interface ConnectionPool{
              MyConnection getCon();
              void freeCon(inout MyConnection c);
    We were suggested to use structures. But ain't it
    inventing java again?
    Can anyone help us?
    Thx anyway.

    Try inserting it into an Any object and sending the any object over the IDL, the client can then extract the connection object.
    You might have to typedef the Connection object in the IDL to generate the helper class.
    /P/

  • Sending a Socket Object via a Socket :P

    eek Sorry all! I accidentally posted in "Java Programming" 1st... I don't know how to delete my post
    http://forum.java.sun.com/thread.jspa?threadID=5261765&tstart=0

    why ?
    At server side you can use input and output streams for communication.
    for example:
    You can have hashmap at serverside and put resp. sockets in it w.r.t. loginid.
    So you have
    key - socket
    loginA - SocketA
    loginB - SocketB
    now write "serialized" message class
    class Message implements Serializable {
    String from,to,message;
    // getter and setters for all
    put this class at client and serverside.
    When B will writeObject(message) to A he will actually writeObject(message) to server.
    Server will use getTo() method of class message.
    Server will get Socket from hashmap using getTo() "key" and will writeObject(message) To A
    Bye the way I am still curious why you want to send socket ?

  • Clearing T420 TPM via WMI won't work

    Hello together,
    right now I'm facing a problem with Thinkpad T420 using the TPM for BitLocker-Encryption after Win 7 installation:
    When having installed Win7 before so that the TPM is already owned, it is not possible to clear the TPM via the TPM WMI.
    Clearing the TPM using the BIOS control panel works just fine.
    But as we can't give the users the BIOS password and have no chance to retrieve the TPM's owner password we are trying to clear the TPM by setting a physical presence request.
    Setting this request seems to work, as during the next reboot the confirmation screen is showing up, asking to confirm clearing by pressing F9.
    But then the actual thing - clearing - just won't happen.
    I've already tried using
    a) the single step requests "clear" followed by "activate" after reboot and
    b) the combined one "clear, enable and activate" .
    But only the enable/activate part realy happens.
    Usualy I would expect the TPM status to change like this:
    a)
    Enabled          True                               True                                   True
    Activated          True    ->clear->          False      ->activate->      True
    Owned            True                               False                                  False
    b)
    Enabled          True                                              ​            True
    Activated         True      ->clear, enable, activet->        True
    Owned            True                                              ​            False
    Instead "owned" will just keep being true.
    On T410 and T500 both a) and b) work exactly as expected.
    I tried using BIOS versions 1.41 and 1.43.
    Anybody having tipps what to do about this? Or this a "works-as-designed" issue, although I can't realy imagine that...?
    Alex

    There is a work-around for this issue.  If you leave the system powered off for 30 seconds after executing the physical presense request, then when you turn the system on you will see the F9 prompt and the TPM will be cleared as expected.  The key step is to leave the system powered off for 30 seconds.
    I will still request a BIOS fix for this issue, but usually such fixes are slow to release.  I hope this work-around can help you for the short-term.

  • Installing Flash version 11.7.700.169 via SMS Won't Work

    When I pushed Flash version 11.6.602.171 via SMS, it worked fine. I used "install_flash_player_11_active_x.msi /qn" and had no problems. Now with version 11.7.700.169, the same command doesn't work. Double clicking on the file works but I can't do it that way for 500 computers. Has anyone else had success installing this version via SMS?
    Thanks.

    Try the offline installer(s) from http://helpx.adobe.com/flash-player/kb/installation-problems-flash-player-windows.html#mai n-pars_header

  • Audio out via HDMI won't work.

    MacBook Air running lastest Lion will not putout audio via HDMI. Video is good, but audio will only play on Air's speakers not on TV. What can I try?

    When you say the adapter works fine on the TV at the store, you mean the very same one you purchased, or anothre Kanex adapter just like yours?
    Also, if you did in fact take your adapter down to the store, did you also take your HDMI cable? How long is your HDMI cable and have you tried another one?
    And another point...is your notebook set to mirror mode within Displays Preferences under the Arrangement tab? If it is, try turning mirroring off so that the TV can run at its own, independent resolution. See if that helps.

  • Send button in Lotus Notes webmail won't work after Firefox update

    I've been using Firefox to connect to my company's Lotus Notes email servers with no problems for months now. Starting this past Friday, after an update, the send buttons no longer work. I can get and view my email but cannot send anything out. Anyone know how to fix this?

    Another work around: in the new message tab change the "format" from rich text to plain text... then the send button works...

  • [N8] Chat via GTalk won't work if Gtalk on the PC ...

    Hi!
    This is rather annoying. The Chat application that comes with the N8 works properly with a Google Talk account, but only if Google Talk application on my PC is not running.
    This issue is probably not due to Google because GTalk allows several clients to be active simultaneously with the same account, for example you can have GTalk running on your PC and your Android phone at the same time.
    Nokia Chat was OK with this in the previous version. The newest version broke something and now it refuses to connect if the client on the PC is active. If I exit it, suddenly I can log in on my N8.
    Is this a known bug? Any suggestions/solutions besides installing Numbuzz, Fring, eBuddy or whatnot - I don't want another client. I want the one that came with my phone to work.
    N8 / RM-596

    Hi ladextr,
    Thanks for using Apple Support Communities.  To sync your music to your iPad, first put your music in iTunes as described here:
    Adding music and other content to iTunes
    http://support.apple.com/kb/ht1473
    Adding content on your computer to iTunes
    iTunes helps you add digital audio and video files on your computer directly to your iTunes library. You can add audio files that are in AAC, MP3, WAV, AIFF, Apple Lossless, or Audible.com (.aa) format. If you have unprotected WMA content, iTunes for Windows can convert these files to one of these formats. You can also add video content in QuickTime or MPEG-4 format to iTunes. To learn how to add these files to iTunes follow the steps below.
    Open iTunes
    From the File menu, choose one of the following choices:
    MacAdd to Library
    Windows
    Add File to Library
    Add Folder to Library
    Navigate to and select the file or folder that you want to add
    If iTunes is set to "Copy files to the iTunes Music folder when adding to library," iTunes will copy all content that is added to the iTunes library to the iTunes Music folder. To adjust this setting or change the location of this folder, go to the Advanced tab in iTunes Preferences.
    Once that's done, you can sync the music to your iPad by following this article:
    iTunes 11 for Windows: Set up syncing for iPod, iPhone, or iPad
    http://support.apple.com/kb/ph12313
    Cheers,
    - Ari

  • Resultset Object

    can any one out there please tell me about how to retrive resultset object through RMI as resultset is not serializable? or should i have to do somthing other than RMI. (which actually i don't want to)

    You cannot send a ResultSet object through RMI, as you
    found out. But don't give up on RMI. Design your own
    object to hold your data, then read through the result
    set on the server and put the data into your new
    custom object. Make sure that's serializable, then
    you can send it through RMI.

  • How to return ResultSet object from Bean to JSP

    I have a Java Bean, in it I have ResultSet Object in a method. Now I want to send this ResultSet Object to the JSP.

    very good advice, otherwise you will spread your sql exception handling over way too many places. Keep it centered, so you can be sure to close your connection, statement, resultset again. Otherwise your database and web application might all of a sudden stop responding.

  • Button won't work after calling another swf

    Hey!
    I have a scene where multiple buttons appear.
    One of them calls a  different swf file with loadMovie(). The other swf has a button that  uses the same function to return to the original swf (i have created a  swf for every scene of the original fla and so I can return to the exact  scene where I was). Another button in my original scene just calls another scene  of the same swf with gotoAndPlay.
    So far so good.
    The problem is that after I go forth and back to the external swf, using the 1st button, the  other button (that sends the user to another scene) won't work. It just  does nothing.
    (Although every other button in the scene keeps working).
    Using AS2 in CS5 (don't ask why i didn't use AS3 - noob).
    Any ideas?
    Thanks

    Ok, the whole scene has a simple loop to keep it running..
    The first button has:
    on (release)
    loadMovie("game.swf",1);
    The button on the external swf has:
    on (release)]
    stopAllSounds();
    loadMovie("project_games.swf",1);     //I have a swf for the original scene to connect the external swf directly with it, rather the whole project swf
    The other button in my original scene (the one that doesn't work after the use of the above two):
    on (release)
    gotoAndPlay("begin",1);                 //begin is the name of a scene in the project
    That's it.
    THanks for your reply my friend.
    Any ideas?

  • Return ResultSet via RMI

    Hello all,
    I understand that it is not possible to return a ResultSet via RMI, correct?
    I have a query that I want to use its recordset and this recordset would then be used as an argument for my TableModel to create the data.
    How can I use a vector or arrayList to transfer the ResultSet via RMI?
    Here's my secenario:
    ==== View.java ==============
    ResultSet rsData = getModel().viewRecord(sortString);
    myTable.setModel(getModel().getMyTableModel(rsData));
    myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ==== Model.java ==============
    public ResultSet viewRecord(String query) {
    try {
    return getDBStatement().executeQuery( query ); <--- instead of this..
    what do I have to do here to return it as a Vector or arrayList
    catch ( SQLException e ) {
    e.printStackTrace();
    return null;
    How do I use RMI to get the record set back and read it for my View?
    Thanks,
    Christopher

    Hello lgurevich ,
    Please forgive me my crazy questions as I'm just starting to learn and implement about RMI.
    Can you or anyone else provide / illustrate to me some specific examples as to how I could do this.
    Here's my logic:
    View - Model (the model is the remote Implementator)
    ====== MyView.java ===========
    String myQuery = "SELECT field1, field2, blah, blah ........ ";
    ResultSet rs = getMyModel().viewRecord(myQuery);
    myTable.setModel(getMyModel().getMyTableModel(rs));
    myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ============================
    ======= MyModel.java ===========
    public ResultSet viewRecord(String query) {
    try {
    return getModelDBStatement().executeQuery( query );
    catch ( SQLException e ) {
    e.printStackTrace();
    return null;
    } // end of viewRecord()
    public MyTableModel getMyTableModel(ResultSet r)
    throws SQLException {
         // Create and return my MyTableModel for the ResultSet
         return new MyTableModel(r);
    ============================
    ======== MyTableModel.java ===========
    public class MyTableModel
    extends AbstractTableModel {
    private ResultSet results;
    Vector totalrows = new Vector();
    public MyTableModel(ResultSet rs) throws SQLException {
    this.results = rs;
    ResultSetMetaData rsmd = rs.getMetaData();
    int columns = rsmd.getColumnCount();
    headers = new String[columns];
    for (int i = 0; i < columns; i++) {
    headers[i] = rsmd.getColumnName(i+1);
    /* ** Create a list of the column data */
    while (rs.next())
    String[] record = new String[columns];
    for (int i = 0; i < columns; i++) {
         record[i] = rs.getString(i+1);
    totalrows.addElement( record );
    } // end of MyTableModel class
    ============================
    So basically, what I'm asking is how do I implement the CachedRowSet to replace the logic of what I have here?
    That is:
    1. To send the query from my view to my model
    2. Model processes the query
    3. Model creates the resultset
    4. Model puts the resultset in the CachedRowSet?
    5. Model sends the CachedRowSet? back to the View.
    6. The View then deserializes? the CachedRowSet? back to a resultset object.
    7. Should I even need to do step 6 considering, I have to send it back to the Model immediately so i could set my TableModel (ie. myTable.setModel(getMyModel().getMyTableModel(rs)); ).
    Any help is greatly appreciated.
    Thanks,
    Christopher

Maybe you are looking for

  • Error 2927 when refreshing host cluster

    We are running SCVMM 2012 R2 on Windows Server 2012 and it manages a 4 node 2012 Hyper-V cluster.  I am receiving the following error when the job "Refresh host cluster" runs: Error (2927) A Hardware Management error has occurred trying to contact se

  • Restricting visibility of table in Adobe form in WdJava when node is empty.

    Dear Experts, We have a requirement for Formcalc or Javascript code for making the table on adobe form invisible when the node corresponding for the table in the form is empty. Please suggest ASAP. Thanks in advance. Regards, Mahesh.

  • Application automation

    hi all, does anybody know a way/method to automate a web user activities such like logging into a web site and retrieving relevant information from the internet? is it possible using the servlet package in J2EE? how about using URLConnection and java

  • CS4 Pro saving video, and audio.. seperate

    I need to have the video and audio together.. not two seperate files, my project is due in two days and I have no idea how to get them both together.. I'm using cs4 master collection!

  • Inserting alternative text to images

    how can you add alternative text to images? which is text that describes an image when the image function is turned off or in another format for blind individuals. This is a ADA compliance requirement in order to export a document to an accessible PD