Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2013
    Posts
    3
    Rep Power
    0

    Default i am trying to get data in array from database

    Java Code:
    package billgen1;
    
    /**
     *
     * @author siddharth
     */
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    public class BillGen1 {
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            // TODO code application logic here
            try
            {
                Class.forName( "com.mysql.jdbc.Driver" );
                
       public String [] MemberName   
          throws SQLException {  
          
        Connection conn = connectionPool.getConnection();  
        Statement qs = conn.createStatement();  
     ResultSet rs = qs.executeQuery("select * from soc1memberbill"); 
     int a=0;
    while(rs.next()) {  
    String Array [a] = rs.getString("MemberName");  
    a++;
    }  
    return x;  
    }  
        }
    }
    i am getting error in public public String [] MemberName
    throws SQLException .. it is saying illegal start of expression
    Last edited by Tolls; 11-29-2013 at 10:13 AM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,097
    Rep Power
    20

    Default Re: i am trying to get data in array from database

    You're declaring a method inside a method.
    Also, please wrap your code in [code] tags [/code] to retain its formatting.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Data processing without Database
    By datathinker in forum JDBC
    Replies: 5
    Last Post: 08-12-2013, 10:54 AM
  2. Inserting Data in database
    By Marty Jones in forum JDBC
    Replies: 2
    Last Post: 12-31-2011, 01:55 PM
  3. Not able to data into database
    By nash1990 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-11-2010, 05:01 PM
  4. why i can't insert data to database
    By khaa_khay in forum Web Frameworks
    Replies: 0
    Last Post: 05-26-2010, 05:37 AM
  5. data between dates in database.
    By mkkrkiran in forum New To Java
    Replies: 1
    Last Post: 09-22-2009, 10:02 AM

Posting Permissions

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