Multiple url handling

Multiple url handling

I want to pick URLs from excel/CSV file and assign those urls to String variable and use that string variable to open the specified url from browser. I have written code to open browser using selenium libraries. Can you please help me in first part?

View Answers

March 3, 2011 at 5:26 PM

Read excel using jdbc:

Follow these steps:

1)Go to the start->Control Panel->Administrative Tools-> data sources.

2)Click Add button and select the Drive do Microsoft Excel(*.xls).

3)After selecting the driver, click finish button.

4)Then give Data Source Name,select drive, directory and excel file to be read and click ok button.

5)Your DSN will get created.

6)Then run the following code:

import java.sql.*;

class GetURLFromExcel{
    public static void main(String[] args){
        try{
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con = DriverManager.getConnection("jdbc:odbc:excel");
         Statement stmt = con.createStatement();
         ResultSet rs = stmt.executeQuery("select * from [sheet$]");
         String url="";
         while (rs.next()){
             url+=rs.getString("URL")+" ";
         }
         String arrURL[]=url.split(" ");
         for(int i=0;i<arrURL.length;i++){
         System.out.println(arrURL[i]);
         }
        }
        catch(Exception e){
            System.out.println(e);
        }
    }
}

March 11, 2011 at 10:58 AM

is there any other approach using jxl APIs or so.. because this would be distributed to different users and user may not have access to create the DSN.









Related Tutorials/Questions & Answers:
Multiple url handling
Multiple url handling  I want to pick URLs from excel/CSV file and assign those urls to String variable and use that string variable to open the specified url from browser. I have written code to open browser using selenium
Handling multiple buttons in HTML Form
Handling multiple buttons in HTML Form  How to handle Handling multiple buttons in HTML Form
Advertisements
Handling multiple combo boxes of same name - IDE Questions
Handling multiple combo boxes of same name  my code is like this.. i'm displaying two combos of same id.. on the browser..if user wants he can
Exception Handling : Multiple Catch
Exception Handling : Multiple Catch In this tutorial, we will discuss the use of declaring multiple catch  with the try block. Multiple Catch : A try statement can have multiple catch blocks. Through multiple catch
Struts2.2.1 handle multiple Submits in your application
Struts2.2.1  handle multiple Submits in your application  In this tutorial, We will discuss about the handling the multiple submits... at a time and other can not aquired and on multiple submit generates error
exception handling
exception handling  explain about exception handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
event handling
event handling  diff btwn event handling in ASP.net and in HTML
File Handling
File Handling  how we do file handling of parsed XML code bu DOM in java
exception handling
exception handling  could you please tell me detail the concept of exception handling
Handling Multiple Catch Clauses
Handling Multiple Catch Clauses   ... block.In java when we handle the exceptions then we can have multiple catch blocks... the implementation of multiple catch blocks for a single try block.ADS_TO_REPLACE_2
exception handling
exception handling   Give the exception hierarchy of Java.   Please visit the following links: http://www.roseindia.net/java/java-exception/exception-java.shtml http://www.roseindia.net/java/exceptions/exception
exception handling
exception handling  What is an exception and what are the advantages of exception handling mechanism.   Java Exception Exception... the working code and the error-handling code can be disintegrated. It also gives us
AdminStrator handling
AdminStrator handling  Hi...Deepak,I want code for adminstrator like adminstrator can handle multiple clients i.e. if adminstrator is adding any file then making it available for all the clients.How to make this availability
multiple inheritance.
multiple inheritance.  hello, can java support multiple inheritance???   hi,ADS_TO_REPLACE_1 java does not support multiple inheritance
error handling mechanism
error handling mechanism  What is Java error handling mechanism
handling Button Event in iphone
handling Button Event in iphone  handling Button Event in iphone
multiple inheritance
multiple inheritance  Class A extends Class B but Class A also inherit Super Class Object so it is multiple inheritence give reason in support of your answer
multiple inheritance
multiple inheritance  why java doesn't support multiple inheritance? we can achieve this by using interface but not with classes? what is the main reason that java community implemented like
Exception Handling in Struts.
Exception Handling in Struts.  How you can do Exception Handling in Struts
Event handling on an image
Event handling on an image  I want to divide an image into frames and want to do event handling on the frames
exception handling in php - PHP
exception handling in php  i need few examples on exception handling in php
Multiple Inheritance
Multiple Inheritance  Why Java Doesn't have Multiple Inheritance It is Advantage or Disadvantage.........   Hi Friend, When we extends... and inconsistencies Java does not support Multiple Inheritance. Thanks
Multiple Inheritance
Multiple Inheritance  All are saying java doesn't support multiple inheritance but by default Object class is super class for all the user defined... class so java any how do multiple inheritance? Can you please explain
exception handling mechanism
exception handling mechanism  Explain Java's exception handling mechanism in detail.   Please visit the following links: http.../exceptions/catching-and-handling-exceptions.shtml
Java exception handling
Java exception handling  what are the constraints imposed by overriding on exception handling
unicode handling in java
unicode handling in java  reading a unicode text file in java
jquery session handling
jquery session handling  What is session handling in JQuery
Add multiple UIBarButtonItem
Add multiple UIBarButtonItem  add multiple uibarbuttonitem
File Handling In Java
File Handling in Java In this section we will discuss about the file handling in Java. This section describes you about how to perform file handling in Java. In this section you will read what is file handling in Java, how to perform
URL Encoding and URL Decoding
URL Encoding and URL Decoding  What is URL Encoding and URL Decoding ?   URL encoding is the method of replacing all the spaces and other extra characters into their corresponding Hex Characters and Decoding
multiple inhertence
multiple inhertence  package start; class A { protected void a() //a method in A { System.out.println("Class A"); } } class B extends A { public B() { super
multiple inhertence
multiple inhertence  package start; class A { protected void a() //a method in A { System.out.println("Class A"); } } class B extends A { public B() { super
Java event handling
Java event handling  Which java.util classes and interfaces support event handling
php error handling function
php error handling function  Is there any library or function that can be used to handle errors in PHP
php download file from url
php download file from url  how to download multiple files in PHP using the URL's
File handling in Java
File handling in Java  Hi, Can any one tell me the basics of File handling in Java? ThanksADS_TO_REPLACE_1   Hi, File handling... provide very good file handling features in their api.ADS_TO_REPLACE_2 You can read
mail with multiple attachments
mail with multiple attachments  code for sending mail with multiple attachments in jsp
uinavigationcontroller add multiple buttons
uinavigationcontroller add multiple buttons  How to add multiple buttons to the UINavigationController
Try and catch in Exception Handling.
Try and catch in Exception Handling.  How can we use try and catch block in exception handling?   Here is an example of Exception handling.... Then to perform exception handling, we have used try and catch block where we have
FILE HANDLING CONCEPT
FILE HANDLING CONCEPT  Write a program to read and write the details of an employee like year of joining, Department code, salary using some byte stream classes

Ads