I am using selenium web driver java built , eclipse editor. To test one of our websites, I use Data-driven testing, retrieving data from a MySQL database.
I dumped the development server database on my local computer and installed this data on my xampp computer and was able to connect to the database and continue the testing process.
To connect to my local database, I use this connection string
String url1 ="jdbc:mysql://localhost:3306/databasename"; String dbClass = "com.mysql.jdbc.Driver"; Class.forName(dbClass).newInstance(); Connection con = DriverManager.getConnection(url1, "root", ""); Statement stmt = (Statement) con.createStatement();
Now I need to connect to our source development server database, which is located on a remote server.
I tried this as a connection string to connect a remote machine
String url1 ="jdbc:mysql://10.0.2.129:3306/test"; String dbClass ="com.mysql.jdbc.Driver"; Class.forName(dbClass).newInstance(); Connection con = DriverManager.getConnection(url1, "root","root");
but cannot connect to the remote computer database. The result of the error is displayed
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method)
Can someone suggest me what changes need to be made to the connection string to connect the remote server database that is protected by ht access ? and how can I run my test cases from my local machine when connected to a remote server database.
Please provide some suggestion.