In selenium testing how to connect with database , any one
pls give the entire information
Answer Posted / 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 View All Answers
What all different approaches can be used for designing an automation solution?
What is tsl?
Can any one give information on "Content Disposition" in TEST COMPLETE automation tool? mail me to pdamarakonda@smart-bridge.co.in call me to 09849423932
hi to all, if we open a browser(for ex. yahoomail.com) using navigate command. the cursor by default focussing on the 'yahoo id' html edit box. how to get the label(ie.,yahoo id) of that html edit box using descriptive program. here we should not use identify tool to get the property,thtml editbox method. by tracing the cursor position we have to get the label name. is it possible? please let me know.
Explain me what is the difference between setspeed() and sleep() methods?
What is the difference between close and quit command?
What you know about table-driven testing?
What generally is the structure of a framework?
Tell us what is the alternate way to click on login button?
How does load testing work for websites?
Do you know the difference between close and quit command?
Do you know what is selenese?
On Test Complete I recorded some keyword test. while I'm running the batch test, if one test case failed, then how test complete skip the failed test case and again continue to run the test case? please provide some way to resolve this issue.
How would you test your own element locator?
Elaborate the scripting standard while executing testing