Results 1 to 2 of 2
  1. #1
    WTF Groupie Array
    Join Date
    Dec 2011
    Posts
    270
    Thanks
    0
    Thanked 2 Times in 2 Posts

    How to retrieve the data from MySQL result set

    How to retrieve the data from MySQL result set ?

  2. #2
    Junior Member Array
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts


    try
    {
    Class.forName(driver).newInstance();
    currentCon = DriverManager.getConnection("jdbc:mysql://192.168.27.111:3306/test");
    System.out.println("Connection with Database established");
    stmt=currentCon.createStatement();
    rs = stmt.executeQuery("select Device from devicemaster");
    System.out.println("searchQuery is executed : "+searchQuery);

    while(rs.next())
    {

    for(int i=0;i<rs.last();i++)
    {
    device[i] = rs.getString(1);
    }
    }

    }
    catch (Exception ex)
    {
    System.out.println("Exception has occurred! " + ex);
    }


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •