In the code below I've to use Pre-built DatabaseManager which has limited exposed functions.
Now I want to fetch resultset of query that gives country names.

DatabaseManager dbhandler = new DatabaseManager();
String query = "Select country_names from Country_Table;";
Vector vResult = dbHandler.getResult(query);   //getResult returns Vector

How can I extract names of the countries from this Vector?
I'm trying to use String[] but not able to.

Thank You

Uhm, toArray(new String[0]) , maybe? See the API docs for Vector.

Hi Raul,

This is the code to set and get the values from vector variable,

Vector<String> vcountry =new Vector<String>();

        //    <E> Element type of Vector e.g. String, Integer, Object ...

        // add vector elements
        vcountry .add("country  1");
        vcountry .add("country   2");
        vcountry .add("country   3");
for(int i=0;i<vcountry .size();i++) // This loop is used to iterate values of vector
            System.out.println("Vector Element "+i+" :"+vcountry .get(i));

I hope this is useful to u...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.