Home Answers Viewqa Java-Beginners Multiple url handling

 
 


Dhananjay
Multiple url handling
2 Answer(s)      2 years and 3 months ago
Posted in : Java Beginners

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 Pages:
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
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
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
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
php download file from url
php download file from url  how to download multiple files in PHP using the URL's
Handling Multiple Catch Clauses
Handling Multiple Catch Clauses   ... block.In java when we handle the exceptions then we can have multiple catch blocks... of multiple catch blocks for a single try block.  
Arrays, loops and string handling
Arrays, loops and string handling  How would i go about in creating a program to mark and grade a set of multiple choice test results. this is a console program that uses JOptionPane dialog boxes as well. Read a set of 10
Exception Handling
Exception Handling      ... exceptions are used for handling errors in programs that occurs during the program... will see that how the exception handling can be done in java program. This example
Error handling - Java Beginners
to the cinema class that demonstrates the usage of the cinema class. Include multiple
Multiple select box
Multiple select box  Hi, I need help in code for multiple select box. The multiple select box should be populated with the db values.The selection done in the multiple select box is to be moved to the text area provided a add
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
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
Friendly URl
Friendly URl  creating a SEO friendly URL
exception handling
exception handling  explain about exception handling
URL problem
URL problem  Hi. I have created a webpage for my project website. in that i have used frameset to split the page. Now if i click any link in the page its navigating to the another page. but the problem is here in the url its
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
hide url
hide url  how i can hide url i have lot of jsp pages when i call one jsp in address another jsp page name also displayed in the address bar? url not visible to endusers please tell me any answer what i should do
event handling
event handling  diff btwn event handling in ASP.net and in HTML
Assigning URL
url to my attendancetemplate.jsp file, please help me if anyone knows, am
Java Spring Desktop application with multiple classes and jframe
Java Spring Desktop application with multiple classes and jframe  Hi i am developing a desktop java spring application..It has many Jframes forms...(); GetCPUInfo();// TODO add your handling code here: } catch
How to convert multiple files in java to .zip format
How to convert multiple files in java to .zip format  i receive multiple files from a remote URL as for (String reportid : reportList) { inputStream = AWSFileUtil.getInputStream
Multiple form in Jsp
Multiple form in Jsp       In this section, we have developed an Multiple form...;userform.jsp") to create the multiple form. <!DOCTYPE HTML PUBLIC
Multiple Forms in JSP
Multiple Forms in JSP      ... to pass user- data to a specified URL which is specified in the action attribute...; <title>Using Multiple Forms</title>
exception handling
exception handling  could you please tell me detail the concept of exception handling
JSP WITH MULTIPLE FORMS
JSP WITH MULTIPLE FORMS       In  this example, you will learn how to make multiple forms in single jsp page. Most of the times people need to use multiple forms
Multiple select dropdown with Ajax
Multiple select dropdown with Ajax This tutorial explains how to create multiple select  dropdown with Ajax  in JSP and Servlet . This example...="text/html; charset=ISO-8859-1"> <title>Multiple
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
Embedded font with multiple typefaces in Flex4
Embedded font with multiple typefaces in Flex4: In this example you can see how we can use a type faces font in multiple form. In this example we use...;!-- Embedded font using multiple faces --> <fx:Style>
Java Multiple Insert Query
Java Multiple Insert Query In this example we will discuss about how to execute multiple insert query in Java. This example explains you about how... the multiple insert query. In this example we will use the Eclipse IDE
how to upload multiple files in jsp and saving the path in database and the file in folder
how to upload multiple files in jsp and saving the path in database and the file in folder  how to upload multiple files in jsp and saving the path... to insert the url of photo and resume in database along with the names. And I need
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
Multiple submit buttons in single xhtml form - Java Server Faces Questions
Multiple submit buttons in single xhtml form  Hi all, Here I am attaching the source of the page , which containig two submit buttons. Somebody suggested to keep eaxh button in different form. I am new to JSF, can anyone split
long url to short url for jsp or servlet
long url to short url for jsp or servlet  I have to convert a url "http://localhost:8080/Popup/popup?phone=111111111". I am unable to do the same. Please any help
fetch url in php - PHP
fetch url in php  How to Fetch URL in PHP
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
javascript for websites url validation
javascript for websites url validation  javascript for websites url validation   JavaScript Code for URL Validation **function isvalidurl(url) { return url.match(/^(ht|f)tps?:\/\/[a-z0-9-.]+.[a-z]{2,4}\/?([^\s<

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.