FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Off Beat Question - Javascript - SQL
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Off Beat Question - Javascript - SQL
Posted: Wed May 22, 2013 09:16 PM

Hello,

I was wondering if someone could help me with a problem connecting to MS SQL server from JavaScript code. The following code is failing at connection.Open(connectionstring);

SQL and IIS 6 are on two different server but on same network. I have opened firewall port 1433; what other items should I look at?

Thank you,

// Script...
<script>
function consignee() {

var consid = document.getElementById("consid").value;
var consname = document.getElementById("consname");

try
{
var connection = new ActiveXObject("ADODB.Connection");
}
catch(e)
{
alert("ADODB namespace not found.");
exit(0);
}

try
{
var connectionstring="Data Source=1.2.3.4;Initial Catalog=SQLDB;User ID=user_id;Password=password;Provider=SQLOLEDB";
connection.Open(connectionstring);
}
catch(e)
{
alert("Cannot connect to SQL DB.");
exit(0);
}

...

</script>

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Off Beat Question - Javascript - SQL
Posted: Wed May 22, 2013 09:55 PM

Darrell:

Perhaps your Windows firewall?, just an idea.

Regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Off Beat Question - Javascript - SQL
Posted: Thu May 23, 2013 12:22 AM

Thank you, I did check that beforehand

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Off Beat Question - Javascript - SQL
Posted: Thu May 23, 2013 08:01 AM

Darrell,

I would check the returned error description:

try
{
var connectionstring="Data Source=1.2.3.4;Initial Catalog=SQLDB;User ID=user_id;Password=password;Provider=SQLOLEDB";
connection.Open(connectionstring);
}
catch(e)
{
alert( e.message );
exit(0);
}

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Off Beat Question - Javascript - SQL
Posted: Thu May 23, 2013 10:22 AM

Darrell,

can you log in with another tool? Did you choose the right location when created the user? Was your user created with the force change password option?

Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Off Beat Question - Javascript - SQL
Posted: Thu May 23, 2013 11:28 AM

Hi Antonio,

Thanks, I got the following error and I am searching internet to find resolution.

"Safety settings on this computer prohibit accessing a data source on another domain."

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Off Beat Question - Javascript - SQL
Posted: Thu May 23, 2013 02:03 PM
Darrell,

This seems valid:
http://www.office-archive.com/58-ms-access/dc6711a5d25b9aa5.htm

This setting can be found on the Internet Options and the Security
Settings. Look under the Miscellaneous.
Access data sources across domains, needs to be enabled.
Please let me know if this helps or if I can be of further assistance.
Thank you for working with the Microsoft Newsgroups
Timothy P Macaulay, Microsoft Certified Professional
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Off Beat Question - Javascript - SQL
Posted: Thu May 23, 2013 03:14 PM

Hi Antonio,

I was able to update the setting on my computer to resolve the problem. However, my concern now is that my customers will not want to change their setting. I am moving IIS6 to same server as MS SQL and will try to access via (local) instead of IP address. I hope this resolves requirement.

Sincerely,

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Off Beat Question - Javascript - SQL
Posted: Thu May 23, 2013 03:26 PM

Yes, good idea :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Off Beat Question - Javascript - SQL
Posted: Thu May 23, 2013 03:36 PM

Hi Antonio,

I moved IIS application to same server as SQL and used the following connection string and I am getting same response. Any idea on what I can do to resolve?

var connectionstring="Data Source=(local);Initial Catalog=XXXX;User ID=XXXXX;Password=XXXXX;Provider=SQLOLEDB";

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Off Beat Question - Javascript - SQL
Posted: Thu May 23, 2013 03:44 PM

Have you tried to create a datasource from "Control Panel", "Administrative tools", "ODBC datasources" ?

It offers a "test" button that allows you to check the connection string

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Off Beat Question - Javascript - SQL
Posted: Fri May 24, 2013 06:50 PM

Hi Antonio,

The System DSN work fine and test works fine. However, when I try to access using the following connection string nothing happens, no popup, no data retrieval...

var connectionstring="DSN=Pasha;User ID=XXXXX;Password=XXXXX;

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Off Beat Question - Javascript - SQL
Posted: Sat May 25, 2013 06:16 AM

Do you get the same error ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Off Beat Question - Javascript - SQL
Posted: Sat May 25, 2013 06:43 AM

Hi Antonio,

No, I tabbed through field with no pop up and no data population.

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Off Beat Question - Javascript - SQL
Posted: Sat May 25, 2013 07:24 AM

Darrell,

Do you mean that you already connected fine ?

Sorry, I don't understand exactly what you meant

regards, saludos

Antonio Linares
www.fivetechsoft.com