Discussion Forum

Welcome to the Discussion Forum, we encourage you to REGISTER on our forum and participate in the debate.For more details Click here

Online Advertising

Viewers now you can promote Your Websites/Blogs/Products by using our online advertising program.Using this feature you can place your Ads in my blog and can attract the people logging over here.To place your ads, just sign in my Guest Book and leave your details over there.

Friday, March 20, 2009

Connecting Database through Webload

In this post we will see how the SQL server and MySQL can be connected thru webload.
1.Connecting to SQL server
Use the script below to connect to the SQL server,
function InitAgenda()
{
//Start generation for Building Block DB GetLine
ConnDetails = new ConnectionDetails()
ConnDetails.DBType = "SQLServer"
ConnDetails.ServerName = "wst00x" //Name of the server where the Sql server is installed
ConnDetails.DatabaseName = "xxx" // Data Source Name
GLFile = DBGetLineInitAgenda (ConnDetails, "select * from dbo.emp", "DBGetLine.tmp", "#", 100, 100)

//End generation for Building Block DB GetLine
}
/***** WLIDE - BuildingBlock:DB GetLine - ID:9 *****/
strArr = GetLine(GLFile, "#")
InfoMessage(strArr[0])
//strArr[0] -> Full record
//strArr[1] -> First field
//strArr[2] -> Second field

// END WLIDE

function TerminateAgenda()
{
//Start generation for Building Block DB GetLine

DBGetLineTerminateAgenda(GLTempFileObj)

//End generation for Building Block DB GetLine
}

Note:
You need to include the line "Integrated Security=SSPI" in the file "DBBuildingBlocks" under Include folder if the SQL Server is using windows authentication.

2.Connecting to MySQL
Use the script below to connect to the MySQL,
function InitAgenda()
{
//Start generation for Building Block MySQL DB GetLine
ConnDetails = new ConnectionDetails()
ConnDetails.ServerName = "xxx.xxx.x.xxx" //Name of the server where mysql is installed
ConnDetails.DBType = "MySQL"
ConnDetails.DatabaseName = "vj" //Database Name
ConnDetails.UserName = "root"
ConnDetails.Password = "xx"
GLFile = DBGetLineInitAgenda (ConnDetails, "select name from elango", "DBGetLine.tmp", "#", 100, 100)

//End generation for Building Block MySQL DB GetLine
}
/***** WLIDE - BuildingBlock:MySQL DB GetLine - ID:2 *****/
strArr = GetLine(GLFile, "#")
InfoMessage(strArr[0])
//strArr[0] -> Full record
//strArr[1] -> First field
//strArr[2] -> Second field
//...
// END WLIDE

function TerminateAgenda()
{
//Start generation for Building Block MySQL DB GetLine
DBGetLineTerminateAgenda(GLTempFileObj)

//End generation for Building Block MySQL DB GetLine
}

Note:
Need to install "mysql-connector-odbc-3.51.27-win32" driver in your system, if you are using the Webload8.1

No comments:

Post a Comment

Free advertising


Lowes Coupon
How to Blog

Free Advertising