Off Beat Question - Javascript - SQL

Off Beat Question - Javascript - SQL

Postby cdmmaui » Wed May 22, 2013 9: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Off Beat Question - Javascript - SQL

Postby Armando » Wed May 22, 2013 9: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
User avatar
Armando
 
Posts: 3223
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Off Beat Question - Javascript - SQL

Postby cdmmaui » Thu May 23, 2013 12:22 am

Thank you, I did check that beforehand
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Off Beat Question - Javascript - SQL

Postby Antonio Linares » Thu May 23, 2013 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Off Beat Question - Javascript - SQL

Postby ADutheil » 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
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Off Beat Question - Javascript - SQL

Postby cdmmaui » 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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Off Beat Question - Javascript - SQL

Postby Antonio Linares » Thu May 23, 2013 2: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Off Beat Question - Javascript - SQL

Postby cdmmaui » Thu May 23, 2013 3: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Off Beat Question - Javascript - SQL

Postby Antonio Linares » Thu May 23, 2013 3:26 pm

Yes, good idea :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Off Beat Question - Javascript - SQL

Postby cdmmaui » Thu May 23, 2013 3: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Off Beat Question - Javascript - SQL

Postby Antonio Linares » Thu May 23, 2013 3: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Off Beat Question - Javascript - SQL

Postby cdmmaui » Fri May 24, 2013 6: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Off Beat Question - Javascript - SQL

Postby Antonio Linares » Sat May 25, 2013 6:16 am

Do you get the same error ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Off Beat Question - Javascript - SQL

Postby cdmmaui » Sat May 25, 2013 6: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
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Off Beat Question - Javascript - SQL

Postby Antonio Linares » Sat May 25, 2013 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 100 guests