Showing posts with label sql-server. Show all posts
Showing posts with label sql-server. Show all posts

Saturday, February 25, 2012

Connecting Sql Server 2005 on Windows 2003 using ASP local

Hello!
I'm migrating an IIS/SQL-Server application from Windows NT4.0 and SQL-
Server 2000 to Windows 2003 Server and SQL-Server 2005.

My problem is that it is not possible to connect local (IIS and SQL-
Server 2005 are runnng on the same node) using ODBC. Running the
applikation on a remote IIS (XPPro) all works fine. I can't see any
differences in the ODBC-configuration.
Any idea?

Thanks(kk035@.hotmail.com) writes:

Quote:

Originally Posted by

I'm migrating an IIS/SQL-Server application from Windows NT4.0 and SQL-
Server 2000 to Windows 2003 Server and SQL-Server 2005.
>
My problem is that it is not possible to connect local (IIS and SQL-
Server 2005 are runnng on the same node) using ODBC. Running the
applikation on a remote IIS (XPPro) all works fine. I can't see any
differences in the ODBC-configuration.


Error messages? Connection strings?

Running IIS and SQL Server on the same machine is not a very good idea,
from the point of view of performance and security. The latter is
particularly critical, if the web application is on the internet.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||It's just an internal application without any performance problems.

strConnect="DSN=ODBC-datasourcename;UID=username;PWD=password"

code snippet:

set conDb = Server.CreateObject("adodb.connection")
conDb.Open Session("strConnect")
for each errDb in conDb.Errors
if errDb.Number <0 then
bDbError = true
Session("strErrTxt1") = errDb.Description
Session("strErrTxt2") = errDb.Source
Session("strErrTxt3") = errDb.SQLState
Session("strErrNbr1") = errDb.Number
Session("strErrNbr2") = errDb.NativeError
exit for
end if
errDb.Clear
next

-err.Db contains no information|||(kk035@.hotmail.com) writes:

Quote:

Originally Posted by

It's just an internal application without any performance problems.
>
strConnect="DSN=ODBC-datasourcename;UID=username;PWD=password"
>
code snippet:
>
set conDb = Server.CreateObject("adodb.connection")
conDb.Open Session("strConnect")
for each errDb in conDb.Errors
if errDb.Number <0 then
bDbError = true
Session("strErrTxt1") = errDb.Description
Session("strErrTxt2") = errDb.Source
Session("strErrTxt3") = errDb.SQLState
Session("strErrNbr1") = errDb.Number
Session("strErrNbr2") = errDb.NativeError
exit for
end if
errDb.Clear
next
>
-err.Db contains no information


But what happens? Does it wait for 15 seconds and give up? Or does attempts
to use the connection fail?

And why use a DSN? Personally, I've never liked DSNs, it just one more
source of error. What is in that DSN?

What happens if you change the DSN part to Provider=SQLNCLI?

Where does the password come from? Is it hard-coded into the
application, or user-entered? Keep in mind that in SQL 2005, passwords
are always case-sensitive.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||On 17 Feb., 15:55, Erland Sommarskog <esq...@.sommarskog.sewrote:

Quote:

Originally Posted by

(k...@.hotmail.com) writes:

Quote:

Originally Posted by

It's just an internal application without any performance problems.


>

Quote:

Originally Posted by

strConnect="DSN=ODBC-datasourcename;UID=username;PWD=password"


>

Quote:

Originally Posted by

code snippet:


>

Quote:

Originally Posted by

set conDb = Server.CreateObject("adodb.connection")
conDb.Open Session("strConnect")
for each errDb in conDb.Errors
if errDb.Number <0 then
bDbError = true
Session("strErrTxt1") = errDb.Description
Session("strErrTxt2") = errDb.Source
Session("strErrTxt3") = errDb.SQLState
Session("strErrNbr1") = errDb.Number
Session("strErrNbr2") = errDb.NativeError
exit for
end if
errDb.Clear
next


>

Quote:

Originally Posted by

-err.Db contains no information


>
But what happens? Does it wait for 15 seconds and give up? Or does attempts
to use the connection fail?
>
And why use a DSN? Personally, I've never liked DSNs, it just one more
source of error. What is in that DSN?
>
What happens if you change the DSN part to Provider=SQLNCLI?
>
Where does the password come from? Is it hard-coded into the
application, or user-entered? Keep in mind that in SQL 2005, passwords
are always case-sensitive.
>
--
Erland Sommarskog, SQL Server MVP, esq...@.sommarskog.se
>
Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx


It seems that it does not wait for 15 seconds - it returns at once.
The password is hard coded. Changing to SQLNCLI doesn't change
anything. Using the same ASP-application on a remote IIS without
changing anything works fine. Using a wrong password in the ODBC-
Configuration to get additional configuration options produces an
entry in the error log of the SQL-Server, which tells that the
password is wrong. Using a wrong password in the DSN for the ASP-
application does not result in an error log entry.|||(kk035@.hotmail.com) writes:

Quote:

Originally Posted by

It seems that it does not wait for 15 seconds - it returns at once.
The password is hard coded. Changing to SQLNCLI doesn't change
anything. Using the same ASP-application on a remote IIS without
changing anything works fine. Using a wrong password in the ODBC-
Configuration to get additional configuration options produces an
entry in the error log of the SQL-Server,


You are talking about the ODBC applet in the Control Panel?

Quote:

Originally Posted by

Using a wrong password in the DSN for the ASP-
application does not result in an error log entry.


A password in the DSN? Didn't you also have a password in the connection
string?

I still don't know why you think the connection failed.

If you leave out "if errDb.Number <0 then" do you get anything in
your Session array?

When you changed to SQLNCLI, did you remove the DSN reference?

What happens if you add "SERVER=bogus;" to the connection string?

What happens if you replace UID and PWD with "Integrated Security=SSPI;"?

Since I don't have to access to your system I have to ask questions in
the dark. Please keep this in mind when you answer the questions, and
try to be as clear and unambiguous as possible. It's enough of a guessing
game for me anyway.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Friday, February 17, 2012

Connecting 32bit ASP to 64 bit SQL Server 2005

issue:

i have an ASP-Application running fine with both SQL Server 2000 and SQL 2005 (both 32 bit)

Now i have to attach a 64bit SQL-Server.

I have a problem with the connection:

This one runs fine with sql 2005 32bit

<%set myConn = Server.CreateObject("ADODB.Connection")

myConn.open "driver={SQL Native Client};server=<servername>;database=<dbname>;uid=<uid>;pwd=<pwd>" %>

but not with the 64-bit server:

ADODB.COnnection error "800a0ea9". Provider is not specified and there is no standard provider.

ok, i did some research and came up with the following:

<%set myConn = Server.CreateObject("ADODB.Connection")

myConn.open "PROVIDER=SQLOLEDB;DATA SOURCE=<serverip>,<serverport>;database=<dbname>;uid=<uid>;pwd=<pwd>" %>

thats fine, now i get a connect.

Unfortunately, this provider seems to behave different to the one i use in 32bit :

Lets say i have a stored procedure"

create spName as

select * from mytable

when i execute the following

<%sqlstr = "exec spname"

set myRecSet = CreateObject("ADODB.Recordset")

myRecSet.open SQLStr, myConn

response.write(myRecSet(0)) %>

it gives the first value of the first row with the Connection to a 32bit SQL-Server

but myRecSet seems to be empty on my 64bit SQL Server the response.write leads to an error message.

As far as i understand this, the provider used when connecting to a 32bit Server returns the records selected by the last row of the stored procedure into the recordset, but the provider when connecting to a 64bit server does not return these results.

What can i do, if i dont want to rewrite my asp-programming. I hope somebody has the correct naming / syntax for an connection string which allows me to connect my asp-application to the 64bit SQLServer which behaves like the "old" one for 32bit.

I hope my comments are clear enough - english is obviously not my mother-tongue - and somebody can give me a hint.

Thanks,

Heinrich

What is the error message?

Tuesday, February 14, 2012

connect to SQL-Server via JDBC

Hello,
I tried a lot of hint from some newsgroups, but without success.
I try to connect to a Microsoft SQL-Server 2000 (Servicepack 4) via JDBC
(original driver from Microsoft). But I get the following error
[SQLServer 2000 Driver for JDBC]Error establishing socket.
My Applikation and my SQL-Server runs at an WindowsXP (SP2)
Please, can you help? nice day and a lot of thanks - Tino Langer
Probably firewall on XP blocking the port.
842242 Some programs seem to stop working after you install Windows XP
Service
http://support.microsoft.com/?id=842242
Matt Neerincx [MSFT]
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"Tino Langer" <tino.langer@.informatik.tu-chemnitz.de> wrote in message
news:ddpevh$3ev$1@.anderson.hrz.tu-chemnitz.de...
> Hello,
> I tried a lot of hint from some newsgroups, but without success.
> I try to connect to a Microsoft SQL-Server 2000 (Servicepack 4) via JDBC
> (original driver from Microsoft). But I get the following error
> [SQLServer 2000 Driver for JDBC]Error establishing socket.
> My Applikation and my SQL-Server runs at an WindowsXP (SP2)
> Please, can you help? nice day and a lot of thanks - Tino Langer
>
>

connect to SQL-Server via JDBC

Hello,
I tried a lot of hint from some newsgroups, but without success.
I try to connect to a Microsoft SQL-Server 2000 (Servicepack 4) via JDBC
(original driver from Microsoft). But I get the following error
[SQLServer 2000 Driver for JDBC]Error establishing socket.
My Applikation and my SQL-Server runs at an WindowsXP (SP2)
Please, can you help? nice day and a lot of thanks - Tino LangerProbably firewall on XP blocking the port.
842242 Some programs seem to stop working after you install Windows XP
Service
http://support.microsoft.com/?id=842242
Matt Neerincx [MSFT]
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
"Tino Langer" <tino.langer@.informatik.tu-chemnitz.de> wrote in message
news:ddpevh$3ev$1@.anderson.hrz.tu-chemnitz.de...
> Hello,
> I tried a lot of hint from some newsgroups, but without success.
> I try to connect to a Microsoft SQL-Server 2000 (Servicepack 4) via JDBC
> (original driver from Microsoft). But I get the following error
> [SQLServer 2000 Driver for JDBC]Error establishing socket.
> My Applikation and my SQL-Server runs at an WindowsXP (SP2)
> Please, can you help? nice day and a lot of thanks - Tino Langer
>
>