This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Simple SQL Connection Test button
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 06, 2015
10:09 AM
Simple SQL Connection Test button
This is an Installscript project that i am working on and i am wanting a simple button that the user can click to test if there is an active SQL db at the location they point to. I already have a custom dialog created and working with my user input sql host address, user and password but im not seeing exactly what i should be using to do a test connection and show a messagebox with either a pass/fail message to the user.
I have been reading about SQLRTInitialize2 and SQLRTConnect2 but have been unsuccessful so far in getting a connection. Any help would be appreciated
I have been reading about SQLRTInitialize2 and SQLRTConnect2 but have been unsuccessful so far in getting a connection. Any help would be appreciated
(8) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 07, 2015
07:25 AM
PlinyElder,
You should be able to connect with SQLRTConnect2:
http://helpnet.installshield.com/installshield18helplib/mergedProjects/installshield18langref/LangrefSQLRTConnect2.htm
http://helpnet.installshield.com/installshield18helplib/SQLRTSupport.htm
HTH
You should be able to connect with SQLRTConnect2:
http://helpnet.installshield.com/installshield18helplib/mergedProjects/installshield18langref/LangrefSQLRTConnect2.htm
http://helpnet.installshield.com/installshield18helplib/SQLRTSupport.htm
HTH
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 07, 2015
09:37 AM
The function below is fired when the "Test" button is clicked by the user
The messagebox returns '0' for the result.
function NUMBER SQL()
STRING sTest, svString;
NUMBER sDB;
begin
sTest = "MyDB";
//First initialize SQL Server runtime
SQLRTInitialize2();
sDB = SQLRTConnect2( "MyTest", "1.1.1.1", FALSE, "sa", "123456", sTest );
NumToStr(svString, sDB);
MessageBox( svString, WARNING );
end;
The messagebox returns '0' for the result.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 07, 2015
09:54 AM
PlinyElder,
0 means it was a success! If you compare your result "sDB" with the InstallShield constant "ISERR_SUCCESS", they should be the same.
HTH
0 means it was a success! If you compare your result "sDB" with the InstallShield constant "ISERR_SUCCESS", they should be the same.
HTH
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 07, 2015
10:11 AM
But its NOT actually a success. The result is returned immediately with '0' when i give the SQL IP address a bogus address. If i supply '0.0.0.0' as the ip address(which should always fail) and enter garbage db info, i always get the same '0' result returned.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 07, 2015
10:38 AM
PlinyElder,
To be honest, I don't have experience using SQLRTConnect2. When I had InstallScript MSI installers, I would instead use SQLRTTestConnection2 and that seemed to work as intended.
http://helpnet.installshield.com/installshield16helplib/mergedProjects/installshield16langref/SQLRTTestConnection2.htm
HTH
To be honest, I don't have experience using SQLRTConnect2. When I had InstallScript MSI installers, I would instead use SQLRTTestConnection2 and that seemed to work as intended.
http://helpnet.installshield.com/installshield16helplib/mergedProjects/installshield16langref/SQLRTTestConnection2.htm
HTH
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 08, 2015
09:13 AM
Anyone else have any ideas? I think i can get SQLRTConnect2 to successfully connect, or ping the address, but i cant get any useful return codes back from it. Its telling me its a failed connection on good and bad ip addresses
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 08, 2015
01:46 PM
SQLRT* functions are designed to work in conjunction with the SQL Scripts view, and the SQLRTConnect function enables you test a connection specified in the ISSQLConnection table. If the connection does not exist, the function just returns 0 and does nothing. Make sure that you have the "MyTest" connection in your project.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 11, 2015
10:37 AM
OK, i figured it out. It was actually pretty simply and i cant believe it took me this long to figure it out.
Using
Using
SQLRTConnect( szConnection, szServer, bTrust, szUserName, szPassword );will return expected result that i can return to the user.