Showing posts with label connects. Show all posts
Showing posts with label connects. Show all posts

Thursday, March 22, 2012

connecting to remote server

Hi friends
we've C# app that connects a sql server 2005. we've new requests from client that when users go offsite they still want use our app and connect to sql server.
my question is how can we connect to sql server remotely ?
is it using TCP/IP protocol ? if so how do we do that ?
Thanks for ur help.

Use SQL Server Configuration Manager, select protocols for your instance. On the right side, enable TCP protocol. You need restart the sql server. If you have firewall, don't forget to put your tcp port into exception, (also UDP port 1434 for sql browser if you have a named instance.)

|||Thanks for that Hong.
i've one more question on this.
what should my connection string contain ? should it contain IP address for server name ?
Thanks again|||btw we use patterns and practices library for our database connections.|||Either IP address or server name should work if your DNS works correctly.
Thanks.|||

Thank you very much for ur replies Hong.

still need some clarification as am not fully aware how DNS works .

currently in our connections string we specify our sql server name as "mallu" and other info like database etc.,(btw we use enterprise library for data access)

are you saying that once we open port on our server and allow remote connects abv connection string just works ? i mean say if we our server is in new zealand and user goes to say australia and he still be able connect ?

Thanks for clarification .

much appreciated you can point me to some resource on these issues on net

|||

Hi prk,

DNS is the Domain Name System -- essentially the directory service that translates your hostnames into IP address. Your network probably has one and your network admin should be able to give you more info.

Regardless of the geography, if your server is configured to listen to a remote protocol and the firewall (if any) is configured properly, you should be able to connect from your client app. The BOL contains some great information on how to do so:

http://msdn2.microsoft.com/en-us/library/ms190608.aspx
http://msdn2.microsoft.com/en-us/library/ms187853.aspx

Also, check out this tutorial on connecting to the database:

http://msdn2.microsoft.com/en-us/library/ms345318.aspx

Il-Sung.

|||Il-Sung
wonderful mate. thank you very much for those links.
am looking something like that.will go thru those articles.
Thanks again.

Thursday, March 8, 2012

Connecting to an instance of SQL

I have a SQL2000 instance that when I attempt to connect to it by
default\NamedInstance it connects me to the default instance on that server
instead. If I connect with (local)\NamedInstance it connects me to the named
instance.
In addition when I attempt to start the agent for the named instance I get
the below:
SQLServerAgent cannot start because the instance of the server (MSSQLSERVER)
is not the expected instance
thanks for your your helpI'd start by checking for aliases in Client Network Utility.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"RomM" <RomM@.discussions.microsoft.com> wrote in message
news:6743587B-BC99-498B-8E1D-519B98C7380C@.microsoft.com...
>I have a SQL2000 instance that when I attempt to connect to it by
> default\NamedInstance it connects me to the default instance on that server
> instead. If I connect with (local)\NamedInstance it connects me to the named
> instance.
> In addition when I attempt to start the agent for the named instance I get
> the below:
> SQLServerAgent cannot start because the instance of the server (MSSQLSERVER)
> is not the expected instance
> thanks for your your help|||It was the correct alias but the port was wrong. I changed and it seems to
be working fine.
What do you think the cause was?
thanks for your help.
"Tibor Karaszi" wrote:
> I'd start by checking for aliases in Client Network Utility.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "RomM" <RomM@.discussions.microsoft.com> wrote in message
> news:6743587B-BC99-498B-8E1D-519B98C7380C@.microsoft.com...
> >I have a SQL2000 instance that when I attempt to connect to it by
> > default\NamedInstance it connects me to the default instance on that server
> > instead. If I connect with (local)\NamedInstance it connects me to the named
> > instance.
> >
> > In addition when I attempt to start the agent for the named instance I get
> > the below:
> > SQLServerAgent cannot start because the instance of the server (MSSQLSERVER)
> > is not the expected instance
> >
> > thanks for your your help
>
>

Connecting to an instance of SQL

I have a SQL2000 instance that when I attempt to connect to it by
default\NamedInstance it connects me to the default instance on that server
instead. If I connect with (local)\NamedInstance it connects me to the name
d
instance.
In addition when I attempt to start the agent for the named instance I get
the below:
SQLServerAgent cannot start because the instance of the server (MSSQLSERVER)
is not the expected instance
thanks for your your helpI'd start by checking for aliases in Client Network Utility.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"RomM" <RomM@.discussions.microsoft.com> wrote in message
news:6743587B-BC99-498B-8E1D-519B98C7380C@.microsoft.com...
>I have a SQL2000 instance that when I attempt to connect to it by
> default\NamedInstance it connects me to the default instance on that serve
r
> instead. If I connect with (local)\NamedInstance it connects me to the na
med
> instance.
> In addition when I attempt to start the agent for the named instance I get
> the below:
> SQLServerAgent cannot start because the instance of the server (MSSQLSERVE
R)
> is not the expected instance
> thanks for your your help|||It was the correct alias but the port was wrong. I changed and it seems to
be working fine.
What do you think the cause was?
thanks for your help.
"Tibor Karaszi" wrote:

> I'd start by checking for aliases in Client Network Utility.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "RomM" <RomM@.discussions.microsoft.com> wrote in message
> news:6743587B-BC99-498B-8E1D-519B98C7380C@.microsoft.com...
>
>

Connecting to a sql server from VB.

I have a VB application that connects to our sql server on one of our local servers. This application needs to be installed on a few computers at a different location.

My question is how do I connect to the sql server on our local server from a remote computer not on our network.??

Thanks in advance.Errrr, you shouldn't. You need to rewrite the application so you have an "application server". :) Now, since I'm sure you aren't going to do that, you will need to open up the SQL Server port to the world and access the database by IP from the remote servers. Alternatively, you can set up an entry to access it as sql.domain.com for example from the outside world.

I hope the data isn't too sensitive. This is just begging someone to hack you.

Wednesday, March 7, 2012

connecting to a linked server using VS2005

hi,

i've currently created a linked server using sql server management studio express (it connects to an oracle database to draw data), i can query it all fine using the query analyzer with sql server etc.

how can i start using the linked server data with visual studio 2005? i can't seem to find the linked server anywhere inside the server explorer, am i suppose to import it / connect to it any specific way so i can start using the data retreived from the linked server?

thanks in advance!

create a view in SQL that reads from this linked server, and in ur server explorer, browse ur view,

Hope this helps

|||

Ramzi.Aynati:

create a view in SQL that reads from this linked server, and in ur server explorer, browse ur view,

Hope this helps

thanks, but how do i create a view?

|||

if you would like to hit linked server in you code just add database name to each object your would like to access. You can run query on server to which you are connected and server will forward your query to linked server. for example if your SQLServer2 is linked server in SQlServer1 you can run query like this om SQLServer1 ( if user you used to link servers have rights to objects in your query)

select * from [SQLserver2].[database].dbo.[tablename]

you can connect results from multiple servers

select * from [SQLserver2].[database].dbo.[tablename]
left join [SQLserver1].[database1].dbo.[tablename1]
ON tablename.aa=tablename1.bb

If you only use linked server in your query you can use OpenQuery which will process data on the linked server and returns only results to you.

SELECT * from OPENQUERY([SQLServer2,' select * from [database].dbo.[tablename]')

Thanks

|||

In your SQL, go to ur query analyzer

and type

Create View View_name as

SELECT *
FROM TEST1.Northwind.dbo.Orders

//where test is ur linked server

This is it, u got urself a view accessible from ur server explorer

|||

I would not recommend to create view like this because it will work very slow. To create view SQL server will try to load all data required to generate view from linked server to your server so it will generate very heavy network traffic and will be very slow. The better way is to get exactly what you need from your linked server or create view on linked server and access it from your main server.

Best solution will be to use Stored procedure to do this or table returned function (but not everything will work in function)

Thanks

|||

jpazgier:

I would not recommend to create view like this because it will work very slow. To create view SQL server will try to load all data required to generate view from linked server to your server so it will generate very heavy network traffic and will be very slow. The better way is to get exactly what you need from your linked server or create view on linked server and access it from your main server.

Best solution will be to use Stored procedure to do this or table returned function (but not everything will work in function)

Thanks

thanks, i might try both options.. would you happen to know of any tutorials that would put me to the right direction in creating a stored procedure to do this? thanks

|||

Dear Frank

As long as the table ur querying is less than 10000 records, u wont feel a pinch, the difference will be in milli seconds,

The topic jpazgier is raising is for really advanced SQL programming and for huge amount of records over 1 million

|||

thanks, have given it a go and i get this error message, any idea what i'm doing wrong?

OLE DB error trace [Non-interface error].

Msg 7312, Level 16, State 1, Procedure OracleComDir, Line 3

Invalid use of schema and/or catalog for OLE DB provider 'MSDAORA'. A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog and/or schema.

|||nevermind, worked it out, thanks :)|||

Dear Frank

Please dont forget to mark the post that helped u the most as answered for sake of future readers

Glad to be of help my friend

|||

jpazgier:

I would not recommend to create view like this because it will work very slow. To create view SQL server will try to load all data required to generate view from linked server to your server so it will generate very heavy network traffic and will be very slow. The better way is to get exactly what you need from your linked server or create view on linked server and access it from your main server.

Best solution will be to use Stored procedure to do this or table returned function (but not everything will work in function)

Thanks

turns out there's about 500,000 records in the database, so results are generating really slow.

i've been attempting to create a stored procedure, but it's still taking 20 odd seconds to bring up the results, here's a basic summary of my stored procedure:

ALTER PROCEDURE GetOracleData
AS

SELECT
oracle_table1.field1,
oracle_table1.field2,
oracle_table2.field1,
oracle_table2.field2

from
OracleCD..oracle_database1.table1,
OracleCD..oracle_database2.table2

WHERE
(oracle_table1.field1 = oracle_table2.field1) AND
(oracle_table1.field2 = oracle_table2.field2)

OracleCD = name of the linked server i created, i'm thinking the fact that i'm calling the data from the linked server is the reason why it's taking soo long for the data to load? what's the best way to call upon data from different databases in a stored procedure?

thanks in advance!

Friday, February 24, 2012

Connecting RS to another server

When I run an RS report on server1 that connects to a sql database on server2
I get the error:
"Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. "
Suggestions?On Jun 7, 1:50 pm, Jimbo <J...@.discussions.microsoft.com> wrote:
> When I run an RS report on server1 that connects to a sql database on server2
> I get the error:
> "Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. "
> Suggestions?
Refer to Reeves Smith's response to your other posting. That would be
my suggestion as well.
Regards,
Enrique Martinez
Sr. Software Consultant

Sunday, February 19, 2012

Connecting from Windows (VB6.0) app to SQL on Internet

Hello,
We have a client-server application written in VB 6.0 that connects to a
SQL Server instance on the local network. We're interested to know if we are
able to use our same VB 6.0 application but connect to a SQL Server that is
hosted on a web domain. That is, if we have our SQL database hosted by a
service provider on the internet, are we able to simply change our connection
string in our application so that we connect to this SQL Server instance and
not the SQL Server on the LAN? If possible we hope to avoid having to
rewrite our application as a .NET application...
Thanks.
Yes that's doable. It's not unusual to develop applications
locally and then change the connection string to access the
"live" database.
-Sue
On Fri, 21 Jan 2005 01:17:02 -0800, aglanz
<aglanz@.discussions.microsoft.com> wrote:

>Hello,
> We have a client-server application written in VB 6.0 that connects to a
>SQL Server instance on the local network. We're interested to know if we are
>able to use our same VB 6.0 application but connect to a SQL Server that is
>hosted on a web domain. That is, if we have our SQL database hosted by a
>service provider on the internet, are we able to simply change our connection
>string in our application so that we connect to this SQL Server instance and
>not the SQL Server on the LAN? If possible we hope to avoid having to
>rewrite our application as a .NET application...
>Thanks.
|||In your connection, you would specify the IP address of the hosting server.
http://www.able-consulting.com/ADO_Conn.htm
"aglanz" <aglanz@.discussions.microsoft.com> wrote in message
news:9E786AE0-5D0C-48DA-86BC-B39F9871CC03@.microsoft.com...
> Hello,
> We have a client-server application written in VB 6.0 that connects to
a
> SQL Server instance on the local network. We're interested to know if we
are
> able to use our same VB 6.0 application but connect to a SQL Server that
is
> hosted on a web domain. That is, if we have our SQL database hosted by a
> service provider on the internet, are we able to simply change our
connection
> string in our application so that we connect to this SQL Server instance
and
> not the SQL Server on the LAN? If possible we hope to avoid having to
> rewrite our application as a .NET application...
> Thanks.
|||Hi,
Can you please let me know how did you connect vb6.0 with MS-SQLServer in a network(LAN)?Iam facing a problem of connecting MS-SQLServer with vb6.0 on the network what i mean is clients cant access the sqlserver?
Regards
Jack

Quote:

Originally posted by aglanz
Hello,
We have a client-server application written in VB 6.0 that connects to a
SQL Server instance on the local network. We're interested to know if we are
able to use our same VB 6.0 application but connect to a SQL Server that is
hosted on a web domain. That is, if we have our SQL database hosted by a
service provider on the internet, are we able to simply change our connection
string in our application so that we connect to this SQL Server instance and
not the SQL Server on the LAN? If possible we hope to avoid having to
rewrite our application as a .NET application...
Thanks.

Connecting from Windows (VB6.0) app to SQL on Internet

Hello,
We have a client-server application written in VB 6.0 that connects to a
SQL Server instance on the local network. We're interested to know if we ar
e
able to use our same VB 6.0 application but connect to a SQL Server that is
hosted on a web domain. That is, if we have our SQL database hosted by a
service provider on the internet, are we able to simply change our connectio
n
string in our application so that we connect to this SQL Server instance and
not the SQL Server on the LAN? If possible we hope to avoid having to
rewrite our application as a .NET application...
Thanks.Yes that's doable. It's not unusual to develop applications
locally and then change the connection string to access the
"live" database.
-Sue
On Fri, 21 Jan 2005 01:17:02 -0800, aglanz
<aglanz@.discussions.microsoft.com> wrote:

>Hello,
> We have a client-server application written in VB 6.0 that connects to
a
>SQL Server instance on the local network. We're interested to know if we a
re
>able to use our same VB 6.0 application but connect to a SQL Server that is
>hosted on a web domain. That is, if we have our SQL database hosted by a
>service provider on the internet, are we able to simply change our connecti
on
>string in our application so that we connect to this SQL Server instance an
d
>not the SQL Server on the LAN? If possible we hope to avoid having to
>rewrite our application as a .NET application...
>Thanks.|||In your connection, you would specify the IP address of the hosting server.
http://www.able-consulting.com/ADO_Conn.htm
"aglanz" <aglanz@.discussions.microsoft.com> wrote in message
news:9E786AE0-5D0C-48DA-86BC-B39F9871CC03@.microsoft.com...
> Hello,
> We have a client-server application written in VB 6.0 that connects to
a
> SQL Server instance on the local network. We're interested to know if we
are
> able to use our same VB 6.0 application but connect to a SQL Server that
is
> hosted on a web domain. That is, if we have our SQL database hosted by a
> service provider on the internet, are we able to simply change our
connection
> string in our application so that we connect to this SQL Server instance
and
> not the SQL Server on the LAN? If possible we hope to avoid having to
> rewrite our application as a .NET application...
> Thanks.

connecting from dreamweaver(i'm a newbie pls. be gentle)

when i try to connect to sql server on my lan using dreamweaver with
javascript it connects(DSN) but when i try C# it says something about the
account (even with the sa account)it won't connect.
Omar,
please can you post up your dreamweaver and C# connectionstrings so we can
narrow down the problem.
TIA,
Paul Ibison

connecting from dreamweaver(i'm a newbie pls. be gentle)

when i try to connect to sql server on my lan using dreamweaver with
javascript it connects(DSN) but when i try C# it says something about the
account (even with the sa account)it won't connect.Omar,
please can you post up your dreamweaver and C# connectionstrings so we can
narrow down the problem.
TIA,
Paul Ibison

connecting from dreamweaver(i'm a newbie pls. be gentle)

when i try to connect to sql server on my lan using dreamweaver with
javascript it connects(DSN) but when i try C# it says something about the
account (even with the sa account)it won't connect.Omar,
please can you post up your dreamweaver and C# connectionstrings so we can
narrow down the problem.
TIA,
Paul Ibison

Sunday, February 12, 2012

Connect to SQL Server from Application on different domain

I have written a VB .Net 2005 application that connects to SQL Server 2005. When both the application and the SQL Server are on the same domain we can connect fine using the connection string: "Data Source = Server1\sqlexpress;Initial Catalog=DB1;Integrated Security=True"

My question/problem is my client has machines at remote locations that they want to run the application on and connect to the database, what do I need to do?

Thanks
Simmy

Hi,

then you either have to impersonate the user in the remote domain context in your application first or use SQL Server authentication to connect to the server.

HTH, Jens Suessmeyer.


http://www.sqlserver2005.de

|||

Hi Simmy,

If your intention is to use integrated authentication, then you need to either (1) create a trust relationship between your client machine's domain of the server machine's domain (assuming that your client machine is part of a domain) or (2) you can create the same local user account with identical passwords on both machines. I don't really recommend (2) since it means that you'll be relying upon NTLM authentication whereas with (1), Kerberos authentication is available (see http://blogs.msdn.com/sql_protocols/archive/2005/10/12/479871.aspx for more information).

Thanks,
Il-Sung.

|||thanks for the help!