In selenium testing how to connect with database , any one
pls give the entire information
Answers were Sorted based on User's Feedback
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 |
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 |
What is test driven development?
Does automation replace manual testing?
Describe common problems of test automation.
Please explain what is the hybrid framework?
notice the distinction between data driven testing and retesting?
What is keyword driven automation?
In Selenium how a test suit is run and report is generated.
Tell me how can you switch back from a frame?
define joins? when you will joins use?
Can we prioritize tests in Junit. What is the sequence of execution in Junit?
Hi, here r some questions, which were asked in Ekaplus, plz process these questions. 1. How we connect with the version?
diff b/w DBMS & RDBMS?
69 Answers BirlaSoft, Infosys, Mind Tree, TCS,