18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Unable to execute the query.
I wrote code to retrieve the records based on criteria.
function getDataFromDB($jdbcDriver, $jdbcURL, $dbUserName, $dbPassword, $query ){
var $db = _getDB($jdbcDriver, $jdbcURL, $dbUserName, $dbPassword);
$rs = $db.select($query);
return $rs;
}
$jdbcDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
$jdbcURL = "jdbc:sqlserver://blrsdsw011:1433;databaseName=DBName";
$dbUserName = "Thomas";
$dbPassword = "Root123";
$queryParameter = '2';
$query = "select * from trans where acctgtranstypeid = 2";
$res = getDataFromDB($jdbcDriver, $jdbcURL, $dbUserName, $dbPassword, $query );
_alert($res.length);
after running the script, I am getting the following error:
JSERROR SyntaxError: unterminated string literal at Jun 8, 2010 6:00:23 PM --> this in HTML report
In console, I didn't get any error.
But when I tried with another table name ex:"select * from trans_dir_type where acctgtranstypeid = 2"; like this it's executed perfectly.
In SAHI, is there any keyword like "trans". If it is there how can i mention my table name "TRANS" in this query.
Could you please help on this?
Thanks & Regards
Tulasi
function getDataFromDB($jdbcDriver, $jdbcURL, $dbUserName, $dbPassword, $query ){
var $db = _getDB($jdbcDriver, $jdbcURL, $dbUserName, $dbPassword);
$rs = $db.select($query);
return $rs;
}
$jdbcDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
$jdbcURL = "jdbc:sqlserver://blrsdsw011:1433;databaseName=DBName";
$dbUserName = "Thomas";
$dbPassword = "Root123";
$queryParameter = '2';
$query = "select * from trans where acctgtranstypeid = 2";
$res = getDataFromDB($jdbcDriver, $jdbcURL, $dbUserName, $dbPassword, $query );
_alert($res.length);
after running the script, I am getting the following error:
JSERROR SyntaxError: unterminated string literal at Jun 8, 2010 6:00:23 PM --> this in HTML report
In console, I didn't get any error.
But when I tried with another table name ex:"select * from trans_dir_type where acctgtranstypeid = 2"; like this it's executed perfectly.
In SAHI, is there any keyword like "trans". If it is there how can i mention my table name "TRANS" in this query.
Could you please help on this?
Thanks & Regards
Tulasi
This discussion has been closed.
Comments
I doubt if there is anything specific to trans. It could be something in the data though which is causing this bug. Could you try querying just a few columns and check whether it works for some columns and does not for others?
Eg.
$query = "select id, value, xxx from trans where acctgtranstypeid = 2";
Regards,
Narayan
Thanks for your quick response.
As per your comments, I checked query with column names instead of "*". I was getting error when i mentioned column name "NOTES" in the query. if don't pass this column name in query i can execute successfully. I need data of this column also. How can i execute query with this column without an error.
Thanks & Regards,
Tulasi
Can you also specify the column type of the NOTES column? It may be that Sahi does not handle that column type or some value in one of the rows of NOTES column may be causing the problem.
If you are using an old version of Sahi, try with the latest release because we fixed a few bugs with quotes in data.
Regards,
Narayan
When i ran this code, i was using old version of SAHI. Now i downloaded new version of SAHI and checked, it's working fine.
Once again Thanks for your valuable comments.
Thanks & Regards,
Tulasi