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
Hi All, Is there any free automation tool for windows application and it's easy to use? I usually take a lot of time to regression test my application when there is a new build on live environments (about same 10 environments) I wish I know a automation tool to regression test and ofcourse it's free, easy to use (maybe using C#) Could anybody can advise to me a tool like that? I very appreciate ^^
Tell us the line of code webdriver driver = new firefoxdriver();.?
Explain what is a relative xpath?
Tell me what criteria do you consider for automating a test?
It is a 30 days project & the client is in Singapur and we have to submit daily report regarding 1) What are the completed works, 2) What are the Pending Works ,3) Work planed for next day. You are free to assume regarding the project. can anybody help me to write an email to the client or Senior person who is staying in abroad
Can you do without a framework?
all clients are using at once if any problem raise?
What are the references for TSL functions.? Could anybody suggest me recommended book for Test Script Language.
Is there any freeware tool for automation testing of mobile applications for BlackBerry and iPhone platforms ?
What is difference between selenium and QTP tools Which is best tool... Which is most used tool
Give some examples for test management tools?
What are the primary features of good automation tool ?
What generally is the structure of a framework?
What is extreme programming and what has it got to do with testing?
What are the different types of testing framework techniques?