In selenium testing how to connect with database , any one

pls give the entire information

Answers were Sorted based on User's Feedback



In selenium testing how to connect with database , any one pls give the entire information..

Answer / guest

Just create a java class for jdbc connection, call it when
you need to connect to database. to crate a jdbc connection
class please follow
http://www.roseindia.net/jdbc/jdbc-mysql/MysqlConnect.shtml

Is This Answer Correct ?    2 Yes 0 No

In selenium testing how to connect with database , any one pls give the entire information..

Answer / sandip

public class dbconnection
{
public static void main(String args[])
{
String email;
String dbUrl = "jdbc:mysql://localhost:3306/test"; //This
URL is based on your IP address
String username="username"; //Default username is root
String password="password"; //Default password is root
String dbClass = "com.mysql.jdbc.Driver";
String query = "Select email from users where user_id = 1;";

try
{

Class.forName(dbClass);
Connection con = DriverManager.getConnection
(dbUrl,username,password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);

while (rs.next())
{
dbtime = rs.getString(1);
System.out.println(email);
} //end while

con.close();
} //end try

catch(ClassNotFoundException e)
{
e.printStackTrace();
}

catch(SQLException e)
{
e.printStackTrace();
}

} //end main

} //end class

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Automation Testing AllOther Interview Questions

On what basis you can map the success of automation testing?

0 Answers  


Name a couple of standard web function found in the function generator?

0 Answers  


What is Database Testing?

5 Answers   Covansys,


how to connect qtp to qc. what are the steps ?

1 Answers   Value Labs,


Where will you maintain information like url, login, password?

0 Answers  


what is 2 tier and 3 tier application.

3 Answers   Value Labs,


1.Which functinalities of QTP using in onlinebanking system? 2.in lift which kind of testing you perform? 3.how do you test money is transform from one account to another account in online banking?

0 Answers   TCS,


How to integrate Rational functional Tester with Rational Quality manager. Can anyone provide the details steps giving explaination with examples.

0 Answers  


What is javascriptexecutor and in which cases javascriptexecutor will help in selenium automation?

0 Answers  


Best Online Training For Tosca Test Suite?Good Online Training For Tosca Test Suite?

0 Answers  


good faculty for selenium in hyderabad?

5 Answers  


Hi Friends, I'm testing a SharePoint application by QTP 8.2 I face a problem that really difficult to me, please take a look on the description below: As you may know, SharePoint is an application is allow customize function from user, so that, user can add many web parts and put at any place they like. For ex: if there are two web parts existing in the SharePoint site When I using QTP to recognize a Web Table on any web part, it has the properties as "Index" and "html tag" only. Problem is: If there is any user changes the display of my web part, the "Index" of Web table is changed as well, so that QTP cannot identify exactly my object. Can anyone help me how to make that object as unique or another way to identify that web table object? Hope to receive many solutions from you. Thanks a lot.

1 Answers   CSC,


Categories