SQL Server Database connection From RFT Scrip
For one of my project i m using RFT. For testing purpose, i need to go to database level n needs to check whether operation performed by RFT is reflected in database or not? Is there any way i can have SQL Server database connection in RFT script itself. I tried using vb script for connecting to SQL database. but got following error when i tried to import SQL client.
Namespace or type 'SqlClient' for the Imports 'System.Data.SqlClient' cannot be found.
Any kind of help is Anticipated.
Re: SQL Server Database connection From RFT Scrip
First you have to create the DSN(data Source Name), In this process you have to select SQL Server database drivers.(Which should be available in your machine).
Then write teh following code
Connection con = DriverManager.getConnection( "DSN name ", UserId, pwd);
Statement stmt = con.createStatement();
// execute select query
String query = "SELECT * FROM " + TABLE_NAME + ";";
ResultSet table = stmt.executeQuery(query);