Showing posts with label application. Show all posts
Showing posts with label application. Show all posts

Tuesday, March 27, 2012

Connecting to SQL Server 2005

Hi all,
I have Windows XP SP2 and SQL Server 2005 CTP installed on my machine.
I am trying to connect to the database in a ASP.net application but no matter how much i try i get the following error message : System.Data.SqlClient.SQLException:SQL Server does not exist or Access denied

I have tried to fix the problmm by checking in all the online blogs and trying out whatever is being suggested , still no luck!!!Sad

Would appreciate if anybody could help me

Thanks.
sshettyThe folks on the SQL Server Data Access forum (http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=87) should be able to help you out with this one.

Raman Iyer
SQL Server Data Mining

Connecting to SQL Server & XP Service Pack 2

I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
running on it prior to the install. I have a C# web application that runs
against a local SQL Server database which I cannot get to work now that I
have installed the XP service pack. I have read all of the Microsoft "HOW To"
documents about configuring SQL Server for the Service Pack but I still
cannot get the Web Appliation to communicate with the database. I always get
the "SQL Server does not exist or access denied." error message. I have tried
the following:
1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
static port SQL Server is using)
2. Added Port 445 (TCP/IP) to the Firewall Exception List
3. Added the sqlserver.exe file to the Firewall Exception List
The database connection string I am using in the web application is:
server=local;uid=sa;pwd=<password>;database=Resear ch
At this point I am not sure what else to try. I cannot connect to the
database if the Firewall is turned off. Should this be the case? Any
assistance is much appreciated.
Sincerely,
Tom Hessen
Hi Tom,
I had the same problem and decided to look at the other end of the
connection. I was running SQL Server ( Service Pack 2 ). When I upgraded
to SQL Server ( Service Pack 3a ) everything started working again.
"Tom Hessen" <Tom Hessen@.discussions.microsoft.com> wrote in message news:<645A76F5-D701-4411-9720-1C6AC67A7ED5@.microsoft.com>...
> I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
> running on it prior to the install. I have a C# web application that runs
> against a local SQL Server database which I cannot get to work now that I
> have installed the XP service pack. I have read all of the Microsoft "HOW To"
> documents about configuring SQL Server for the Service Pack but I still
> cannot get the Web Appliation to communicate with the database. I always get
> the "SQL Server does not exist or access denied." error message. I have tried
> the following:
> 1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
> static port SQL Server is using)
> 2. Added Port 445 (TCP/IP) to the Firewall Exception List
> 3. Added the sqlserver.exe file to the Firewall Exception List
> The database connection string I am using in the web application is:
> server=local;uid=sa;pwd=<password>;database=Resear ch
> At this point I am not sure what else to try. I cannot connect to the
> database if the Firewall is turned off. Should this be the case? Any
> assistance is much appreciated.
> Sincerely,
> Tom Hessen
|||Hi Tom,
I've had a little trouble posting, but hopefully this will get through.
I also did everything you listed below. It did not work for me
either ( for a java client ).
I then decided to look at the other end of the connection. I was running
SQLServer ( Service Pack 2 ). When I upgraded to SQLServer ( Service Pack
3a ) everything started working again.
Hope this helps,
Mike S.
"Tom Hessen" <Tom Hessen@.discussions.microsoft.com> wrote in message news:<645A76F5-D701-4411-9720-1C6AC67A7ED5@.microsoft.com>...
> I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
> running on it prior to the install. I have a C# web application that runs
> against a local SQL Server database which I cannot get to work now that I
> have installed the XP service pack. I have read all of the Microsoft "HOW To"
> documents about configuring SQL Server for the Service Pack but I still
> cannot get the Web Appliation to communicate with the database. I always get
> the "SQL Server does not exist or access denied." error message. I have tried
> the following:
> 1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
> static port SQL Server is using)
> 2. Added Port 445 (TCP/IP) to the Firewall Exception List
> 3. Added the sqlserver.exe file to the Firewall Exception List
> The database connection string I am using in the web application is:
> server=local;uid=sa;pwd=<password>;database=Resear ch
> At this point I am not sure what else to try. I cannot connect to the
> database if the Firewall is turned off. Should this be the case? Any
> assistance is much appreciated.
> Sincerely,
> Tom Hessen
sqlsql

Connecting to SQL Server & XP Service Pack 2

I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
running on it prior to the install. I have a C# web application that runs
against a local SQL Server database which I cannot get to work now that I
have installed the XP service pack. I have read all of the Microsoft "HOW To"
documents about configuring SQL Server for the Service Pack but I still
cannot get the Web Appliation to communicate with the database. I always get
the "SQL Server does not exist or access denied." error message. I have tried
the following:
1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
static port SQL Server is using)
2. Added Port 445 (TCP/IP) to the Firewall Exception List
3. Added the sqlserver.exe file to the Firewall Exception List
The database connection string I am using in the web application is:
server=local;uid=sa;pwd=<password>;database=Research
At this point I am not sure what else to try. I cannot connect to the
database if the Firewall is turned off. Should this be the case? Any
assistance is much appreciated.
Sincerely,
Tom HessenHi Tom,
I had the same problem and decided to look at the other end of the
connection. I was running SQL Server ( Service Pack 2 ). When I upgraded
to SQL Server ( Service Pack 3a ) everything started working again.
"Tom Hessen" <Tom Hessen@.discussions.microsoft.com> wrote in message news:<645A76F5-D701-4411-9720-1C6AC67A7ED5@.microsoft.com>...
> I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
> running on it prior to the install. I have a C# web application that runs
> against a local SQL Server database which I cannot get to work now that I
> have installed the XP service pack. I have read all of the Microsoft "HOW To"
> documents about configuring SQL Server for the Service Pack but I still
> cannot get the Web Appliation to communicate with the database. I always get
> the "SQL Server does not exist or access denied." error message. I have tried
> the following:
> 1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
> static port SQL Server is using)
> 2. Added Port 445 (TCP/IP) to the Firewall Exception List
> 3. Added the sqlserver.exe file to the Firewall Exception List
> The database connection string I am using in the web application is:
> server=local;uid=sa;pwd=<password>;database=Research
> At this point I am not sure what else to try. I cannot connect to the
> database if the Firewall is turned off. Should this be the case? Any
> assistance is much appreciated.
> Sincerely,
> Tom Hessen|||Hi Tom,
I've had a little trouble posting, but hopefully this will get through.
I also did everything you listed below. It did not work for me
either ( for a java client ).
I then decided to look at the other end of the connection. I was running
SQLServer ( Service Pack 2 ). When I upgraded to SQLServer ( Service Pack
3a ) everything started working again.
Hope this helps,
Mike S.
"Tom Hessen" <Tom Hessen@.discussions.microsoft.com> wrote in message news:<645A76F5-D701-4411-9720-1C6AC67A7ED5@.microsoft.com>...
> I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
> running on it prior to the install. I have a C# web application that runs
> against a local SQL Server database which I cannot get to work now that I
> have installed the XP service pack. I have read all of the Microsoft "HOW To"
> documents about configuring SQL Server for the Service Pack but I still
> cannot get the Web Appliation to communicate with the database. I always get
> the "SQL Server does not exist or access denied." error message. I have tried
> the following:
> 1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
> static port SQL Server is using)
> 2. Added Port 445 (TCP/IP) to the Firewall Exception List
> 3. Added the sqlserver.exe file to the Firewall Exception List
> The database connection string I am using in the web application is:
> server=local;uid=sa;pwd=<password>;database=Research
> At this point I am not sure what else to try. I cannot connect to the
> database if the Firewall is turned off. Should this be the case? Any
> assistance is much appreciated.
> Sincerely,
> Tom Hessen

Connecting to SQL server

Hi

i'm having lots of problems connecting my application to a database. I'm using Visual Web developer 2008 (coding in VB) and trying to connect to a locally installed version SQL server Express.

what i'm trying to do is using a DropDownList box get a user to select a name. This will then automaticly run a SQL query to pull data out of the DB and into a GridView. i'm coding (in VB only) everything under the DropDownList.SelectedIndexChanged section.


the query i want to run is -

SELECT name, description, data_added, priority_id FROM task WHERE (owner_id = (SELECT owner_id FROM owner WHERE (owner_id = @.owner_id)

The owner_id field references another table (owner). Therefore i run the inner query to get the owner_id based on the selected name in the dropDownlist, then let the outer query pull out all tasks which match the result from the inner query.

my code at the moment is

Dim dsAsNew DataSet

Dim myconnectionAs SqlConnection'create a connection

'create connection to DB

myconnection.ConnectionString ="server=localhost;database=taskDB"

'create the sql command

Dim objcmdAsNew SqlCommand("SELECT name, description, data_added, priority_id FROM task WHERE (owner_id = (SELECT owner_id FROM owner WHERE (owner_id = @.owner_id)))", myconnection)

objcmd.Connection.Open()

'open the connection to DB

Dim objreaderAs SqlDataReader = objcmd.ExecuteReader

Dim daAsNew SqlDataAdapter

da.SelectCommand = objcmd

'fails here sql not allowing remote connection

da.Fill(ds)

Me.GridView1.DataSource = da

Me.GridView1.DataBind()

'close the connection to the DB

objcmd.Connection.Close()

The application fails when you select a name from the drop down box.

fails at - myconnection.ConnectionString ="server=localhost;database=taskDB"Error is "Object reference not set to an instance of an object." If i comment out this line, i get the same error but at it stopps at the objcmd.connection.open(). Strange.

Can anyone tell me what i am doing wrong? Have i setup the connection to the DB ok?

Thanks

Cj

You to use the keyword New when creating an object of class SqlConnection.

Dim myconnectionAs New SqlConnection

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx

Also, the connection string to the database doesn't seem to be right. Have a look at this and try modifying your connection string:

http://www.connectionstrings.com/?carrier=sqlserver2005

connecting to sql server

Dear Sirs,
I am working on my first sql server web application. I have read many documents and I have gone to many forums, but i have'nt found any answer. Can you help me please.
Here is my problem:
I can't connect to my database. I use windows authentication and i log in as administrator. I have installed home edition of sql server and IIS is installed in my computer. I use this scripts:

<%
dim objCon
set objCon = server.CreateObject("ADODB.Connection")
objCon.ConnectionString="DSN=dbna.dsn;uid=sa;pwd=;database=na2"
objCon.open
%>

Where dbna.dsn have been defined in "Data Sources (ODBC)" part of control panel.
When I open the my webpage i receive this error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'ALADDIN\IUSR_ALADDIN'.
/dbconnect.asp, line 5

My computer name is ALADDIN and my username is Omid.
Best regards,
Omid.SQL thinks that you are trying to connect using windows authentication. Check the settings on your DSN entry.

As an aside, I would avoid using a DSN entry if you can. Instead, use MS OLE DB for SQL Server.

Check out this web site for some good examples: www.connectionstrings.com.

Regards,

hmscott|||Also, Carl Prothman's Connection String Site (http://www.carlprothman.net/Default.aspx?tabid=81) is pretty handy.|||Thanks alot for your helps but I can't connect to my database yet. I tried OLE DB too but I received the same error. I think something is wrong in my sql server. Can you tell me please what are the main steps for preparing a sql server database.
Regards,
Omid.|||Also, Carl Prothman's Connection String Site (http://www.carlprothman.net/Default.aspx?tabid=81) is pretty handy.
Thanks alot for your helps but I can't connect to my database yet. I tried OLE DB too but I received the same error. I think something is wrong in my sql server. Can you tell me please what are the main steps for preparing a sql server database.
Regards,
Omid.|||Change SQL authentication mode to MIXED if you are trying to log on with sa/pwd mode.|||Change SQL authentication mode to MIXED if you are trying to log on with sa/pwd.|||I don't want to log on with sa/pwd. I want to use windows authentication.

Sunday, March 25, 2012

Connecting to SQL Express Database in C# Application

I'm trying to connect to a sql express database on my local machine, using the following connection string:

SqlConnection thisConnection = new SqlConnection(@."Data Source=C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Test.mdf");

However, I keep getting an error message saying "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections."

Why would my application be trying to connect remotely when the database is on my local machine? And how can I fix this problem?

Thanks

There 'should' be three major components to a connection string: source (or server), catalog (or database), and security information. You have only a source listed.

Check out legitimate SQL Server connection strings at: http://connectionstrings.com/?carrier=sqlserver2005

|||Thanks for the help!

Connecting to SQL Data Base with ADODB

Hi I need help regarding ADODB Connection that i have used in connecting database in my web application, do tell me is this connection type is ok? or I need to switch to ADO.NET Connection.

Hi There,

Of course you still can use ADODB, below is some example:

http://www.dotnetcoders.com/web/Articles/ShowArticle.aspx?article=54

http://www.vbdotnetheaven.com/UploadFile/ptailor/ADODBServices04082005081324AM/ADODBServices.aspx

Having said that, i long run, you should migrate to ADO.net. ;) Good luck!

Thursday, March 22, 2012

Connecting to SBS SQL via Remote VPN (VB Application)

Hi,
Dont really know if this is the place to ask but here goes...
I have written a VB application that talks to various SQL2000 Tables. But i
need to expand the VB App to work on a laptop thats remotely connected by VP
N.
Even though the laptop is connected via VPN and can use server applications
it cannot see the SQL server? and produces (can find it errors).
Is there anything i need to do to the sql server to allow outside
connections or to the ISA firewall etc etc.
Any help will be appreciated.
Regards
TIMIf you know that your VPN connection is working correctly, then next try
connecting to the database server using it's IP and port as the data source:
http://www.carlprothman.net/Default...derForSQLServer
If that doesn't work, then speak with your DBA and/or network admin. Perhaps
the following is relevent to your situation:
How To Use ADO to Connect to a SQL Server That Is Behind a Firewall
http://support.microsoft.com/defaul...b;en-us;Q269882
INF: TCP Ports Needed for Communication to SQL Server Through a Firewall
http://support.microsoft.com/defaul...b;EN-US;q287932
"TIM" <TIM@.discussions.microsoft.com> wrote in message
news:C10D5F9D-F628-4B57-9EF3-707C9E621DA9@.microsoft.com...
> Hi,
> Dont really know if this is the place to ask but here goes...
> I have written a VB application that talks to various SQL2000 Tables. But
> i
> need to expand the VB App to work on a laptop thats remotely connected by
> VPN.
> Even though the laptop is connected via VPN and can use server
> applications
> it cannot see the SQL server? and produces (can find it errors).
> Is there anything i need to do to the sql server to allow outside
> connections or to the ISA firewall etc etc.
> Any help will be appreciated.
> Regards
> TIMsqlsql

Connecting to remote sql server 2005

Dear All,

I am quite new to sql server 2005. Now I am going to develop a new asp.net application connecting to sql server 2005 remotely. So what must I have install in order to connect to a remote sql server and also to enable me build the tables too? What are the softwares that I need to install before I can proceed on this ? If possible I wnat to avoiding installing the whole server into my local machine as I dont need it. Thanks.

You might find these to be good resources to get you started out.

http://asp.net/learn/dataaccess/default.aspx?tabid=63

http://asp.net/learn/videos/default.aspx?tabid=63

http://msdn.microsoft.com/vstudio/express/sql/learning/default.aspx

|||

Dear Arnie,

Thanks for the link. Thus that means minimally I must install the sql express is it? Thanks.

|||

No, you do not 'have' to install SQL Express.

However, you might benefit from having a local copy to learn with and explore.

Minimally, you will need a client tool or environment that will connect to the SQL Server.

That client environment 'could be' Visual Studio.

It could also be the SQL Server Management Studio Express client tool.

|||

Dear Arnie,

I dont mind installing the express version. But I just want to know is it the same like the orginial sql server 2005 ? Thanks.

|||

Every thing that you can do in SQL Express, you can do in the other editions. SQL Express is the same product code base.

However, there are a few 'enterprise' level features that are not included in SQL Express. Integration Services and Replication are a couple that come to mind.

You can compare the editions here to get a better idea. (However, for learning how to use SQL Server to support a web site, SQL Express will be a good tool for you.)

SQL Server 2005 Features, Version Comparison
http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx

|||

Dear Arnie,

Thank you a lot of man all your information was very helpful. So I will start working with it. So in case I am stuck then I will get back to you. Really appreciate you a lot.

|||

Dear Arnie,

Ok I have download both the sql express and also the sql server managment studio express. I all working i can log into my database. The problem is that it is using the windows authentication. I would like to make my own account and create a user name and password. I dont know how to go about ? Can you please help me on this ? Thanks.

|||

You might find the tutorial videos on these sites to be well worth your time and effort.

For SQL Server (especially Lesson Seven):

http://msdn.microsoft.com/vstudio/express/sql/learning/default.aspx#1

For ASP:

http://asp.net/learn/videos/default.aspx?tabid=63

Tuesday, March 20, 2012

Connecting to remote database?

I am using SQL Server 2000 database in my VB.Net project.

My VB.net application is installed one two machines in different cities i.e. there are two separate databases.

First machine's IP address is say 202.33.44.55 and other machine IP address is say 203.33.55.66. Now I want to use each others databases i.e. I want to set their database group.

So that in my VB.Net's application which is installed on 202.33.44.55 I could see data of the 203.33.55.66 by just changing the connection string

You can include both connection strings in the web.config and then change the data source via dynamic code.

This method works well when there are applications running on the server with each using a different data source.

The web.config might look like this:

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<clear />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=servername;Initial Catalog=database;User ID=user;Password=password;" providerName="System.Data.SqlClient" />
<remove name="ConnectionString1"/>
<add name="ConnectionString1" connectionString="Data Source=servername1;Initial Catalog=database1;User ID=user;Password=password;" providerName="System.Data.SqlClient" />
<remove name="ConnectionString2"/>
<add name="ConnectionString2" connectionString="Data Source=servername2;Initial Catalog=database2;User ID=user;Password=password;" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>

|||

harshal_shravgi:

I am using SQL Server 2000 database in my VB.Net project.

My VB.net application is installed one two machines in different cities i.e. there are two separate databases.

First machine's IP address is say 202.33.44.55 and other machine IP address is say 203.33.55.66. Now I want to use each others databases i.e. I want to set their database group.

So that in my VB.Net's application which is installed on 202.33.44.55 I could see data of the 203.33.55.66 by just changing the connection string

There is nothing dynamic in this Asp.net needs an account in the second server which should be added to SQL Server and the database, so you need to create a Windows account for Asp.net in the second server and grant that account permissions to SQL Server and the database. Hope this helps.

|||

Actually I want to set their database groups and as I said those two machines are not in my LAN. Those two machines are in different cities.

When I try setup a new sql group then I cann't see 203.33.55.66 from 202.33.44.55.

Above two IP addresses will be live IP address.

|||

harshal_shravgi:

Actually I want to set their database groups and as I said those two machines are not in my LAN. Those two machines are in different cities.

When I try setup a new sql group then I cann't see 203.33.55.66 from 202.33.44.55.

Above two IP addresses will be live IP address.

I have told you what you need to do location is not relevant if you do it your application will run, some of these security issues are created by developers who thinks database servers should let their application run without valid permissions.

|||

In my code I am using following connection string -

Provider=SQLOLEDB.1;Data Source=202.33.44.55;Initial Catalog= SLV2;UserId=sa;Password=;

It gives error that database does not exist.

What should I give datasource that database does not exist on my machine i.e. 203.33.55.66? And as I said when I tried to setup a new group in SQL Server then its not showing me that other machine database.

So I think its not the issue of coding, firstly I should be able set a group of databases in SQL Server then only I will be able to use it in my code.

|||

Hi,

You also need to check if the SQL Server instance you're connecting to is the default instance on 203.33.55.66. Is the instance on the default port 1433?

Please also check if the database named SLV2 exists on that machine and if sa with no password is a valid user name.

You can test this with SQL Server management studio or with a UDL file. Here are the steps creating a UDL file.

1. Create a text file on your desktop and rename it to XXX.udl
2. Double click on the file and a Data Link Property dialog box will be shown.
3. Setup the connection and use Test Connection button to test it.

HTH.

|||

Exactly when I tried to connect using .UDL file I didn't found that other machine.

So what to do now?

|||

harshal_shravgi:

Exactly when I tried to connect using .UDL file I didn't found that other machine.

So what to do now?

You need to create a domain account for Asp.net then grant that account permissions in SQL Server and database, sa is not a Windows account.

http://support.microsoft.com/kb/328306

|||

Hi,

And you can also connect to the database using SQL authentication. But the server should enable SQL authentication first.

HTH.

Monday, March 19, 2012

Connecting to MSSQL Server 2000 using JDBC

Hello,

I am developing an application which needs JDBC connection to a Named Instance of SQL Server 2000 (other than default instance). I am facing problem in this regard as my code gives an exception "Time Out" or "Connection Failed". However it works fine with the default named instance...The main driver class is "com.microsoft.sqlserver.jdbc.SQLServerDriver"

and Connection URL is

"jdbc: sqlserver://localhost;instanceName=Testing:1432;databaseName=testDB;"

It gives the exception that Unable to connect to named instance....

Please if any one have any knowledge in this regard....do let me know....I have read an article on MSDN according to which on MS SQL Server 2000 the named Instance other than default can be accessed only through named pipes.

http://msdn2.microsoft.com/en-us/library/aa224779(sql.80).aspx

if some body can tell me Connection string for JDBC driver which utilizes named pipes...the it will be very help full for me.........any help from MSDN Experts is really appreciated...

Thanks

Muhammad:

The JDBC driver does connect to named instances but doesn't use Named Pipes -- only TCP/IP. In your case it looks like you're overloading the instanceName property in the connection string by putting the instanceName and portNumber together. Try breaking them apart like this:

"jdbc: sqlserver://localhost;instanceName=Testing;portNumber=1432;databaseName=testDB;"

If that still doesn't work let me know.

-shelby

|||

Thanks Shelby for your quick reply.....I have tried the string you have given and it is given the same error..

"com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect

at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)

at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)

at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)

at java.sql.DriverManager.getConnection(DriverManager.java:525)

at java.sql.DriverManager.getConnection(DriverManager.java:193)

at com.frt.test.DatabaseTest.main(DatabaseTest.java:21)"

One thing i want to discuss with you is that when I go to "Server Network utility" the value written in default port for the second instance in "TCP/IP" is 0..why it is so? I have chaged it to 1432 myself and have restarted the server again....My code is as follows (however it is very simple but I am sending it)

import java.sql.*;

public class DatabaseTest
{
public static void main(String[] args)
{
try
{
java.lang.Class.forName( "com.microsoft.sqlserver.jdbc.SQLServerDriver" );
// Class.forName("com.inet.tds.TdsDriver");
Connection c = java.sql.DriverManager.getConnection( "jdbcTongue Tiedqlserver://localhost;instanceName=TESTING;portNumber=1432;databaseName=testDB;" );
// Connection c = java.sql.DriverManager.getConnection( "jdbcTongue Tiedqlserver://localhost/pipe/MSSQL$TESTING/sql/query?database=testDB&user=sa&password=abc");
// Connection c = DriverManager.getConnection("jdbc:inetdae7://localhost/pipe/MSSQL$TESTING/sql/query?database=CMS&user=sa&password=abc");
Statement s = c.createStatement();
ResultSet r =s.executeQuery("select * from table1");
while(r.next())
{
System.out.println(r.getString(2));
}
System.out.println( "Connected!" );
}
catch( Exception ex )
{
ex.printStackTrace();
}
}
}

as you can see that in connection statement I have commented out some lines....that is connection string of some other driver I have downloaded for testing...and when I use it with piped names it connects perfectly to named instance...but I have to use the first driver....so please help me...

Thanks for your coordination

bye

|||

At last i got the solution.....All the problem is due to cause that Service Pack 3.0 for SQL Server 2000 was not installed on my machine...as it is a bug in SQL Server 2000, that it does not listen on TCP/IP port, as u can verify by using TELNET, however this bug has been removed in SP3

Regards

Muhammad Ummar

Connecting to MSSQL Server 2000 using JDBC

Hello,

I am developing an application which needs JDBC connection to a Named Instance of SQL Server 2000 (other than default instance). I am facing problem in this regard as my code gives an exception "Time Out" or "Connection Failed". However it works fine with the default named instance...The main driver class is "com.microsoft.sqlserver.jdbc.SQLServerDriver"

and Connection URL is

"jdbc: sqlserver://localhost;instanceName=Testing:1432;databaseName=testDB;"

It gives the exception that Unable to connect to named instance....

Please if any one have any knowledge in this regard....do let me know....I have read an article on MSDN according to which on MS SQL Server 2000 the named Instance other than default can be accessed only through named pipes.

http://msdn2.microsoft.com/en-us/library/aa224779(sql.80).aspx

if some body can tell me Connection string for JDBC driver which utilizes named pipes...the it will be very help full for me.........any help from MSDN Experts is really appreciated...

Thanks

Muhammad:

The JDBC driver does connect to named instances but doesn't use Named Pipes -- only TCP/IP. In your case it looks like you're overloading the instanceName property in the connection string by putting the instanceName and portNumber together. Try breaking them apart like this:

"jdbc: sqlserver://localhost;instanceName=Testing;portNumber=1432;databaseName=testDB;"

If that still doesn't work let me know.

-shelby

|||

Thanks Shelby for your quick reply.....I have tried the string you have given and it is given the same error..

"com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect

at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)

at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)

at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)

at java.sql.DriverManager.getConnection(DriverManager.java:525)

at java.sql.DriverManager.getConnection(DriverManager.java:193)

at com.frt.test.DatabaseTest.main(DatabaseTest.java:21)"

One thing i want to discuss with you is that when I go to "Server Network utility" the value written in default port for the second instance in "TCP/IP" is 0..why it is so? I have chaged it to 1432 myself and have restarted the server again....My code is as follows (however it is very simple but I am sending it)

import java.sql.*;

public class DatabaseTest
{
public static void main(String[] args)
{
try
{
java.lang.Class.forName( "com.microsoft.sqlserver.jdbc.SQLServerDriver" );
// Class.forName("com.inet.tds.TdsDriver");
Connection c = java.sql.DriverManager.getConnection( "jdbcTongue Tiedqlserver://localhost;instanceName=TESTING;portNumber=1432;databaseName=testDB;" );
// Connection c = java.sql.DriverManager.getConnection( "jdbcTongue Tiedqlserver://localhost/pipe/MSSQL$TESTING/sql/query?database=testDB&user=sa&password=abc");
// Connection c = DriverManager.getConnection("jdbc:inetdae7://localhost/pipe/MSSQL$TESTING/sql/query?database=CMS&user=sa&password=abc");
Statement s = c.createStatement();
ResultSet r =s.executeQuery("select * from table1");
while(r.next())
{
System.out.println(r.getString(2));
}
System.out.println( "Connected!" );
}
catch( Exception ex )
{
ex.printStackTrace();
}
}
}

as you can see that in connection statement I have commented out some lines....that is connection string of some other driver I have downloaded for testing...and when I use it with piped names it connects perfectly to named instance...but I have to use the first driver....so please help me...

Thanks for your coordination

bye

|||

At last i got the solution.....All the problem is due to cause that Service Pack 3.0 for SQL Server 2000 was not installed on my machine...as it is a bug in SQL Server 2000, that it does not listen on TCP/IP port, as u can verify by using TELNET, however this bug has been removed in SP3

Regards

Muhammad Ummar

connecting to MSDE on Windows 2003 SBS Server

I have an application (Point of Sale System) that utilizes a MSDE
database. The server came loaded with MSDE instances already and I
installed one for the POS System. The client PCs can see the other 3
MSDE instances, but cannot see the one I installed. Any ideas on how
the new instance can appear on the network. The new instance was not
named. The other three were named instances of MSDE.
hi,
auschnet@.gmail.com wrote:
> I have an application (Point of Sale System) that utilizes a MSDE
> database. The server came loaded with MSDE instances already and I
> installed one for the POS System. The client PCs can see the other 3
> MSDE instances, but cannot see the one I installed. Any ideas on how
> the new instance can appear on the network. The new instance was not
> named. The other three were named instances of MSDE.
please verify the required/desired network protocols are enabled... MSDE
installs by default disabling them and you can override this behavior
providing the
DISABLENETWORKPROTOCOLS=0
parameter to the setup.exe boostrap installer, or later, at run time, using
the Server Network Utility (svrnetcn.exe) and enabling the preferred network
protocol..
additionally, WinXP sp2 ships with a built-in Firewall that's enabled by
default, preventing network connections to... if this is a case, you have to
specify an exception for the service or for the MSDE used port, usually
specifying a subnet or individual remot IP addreses to restrict
connections...
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.15.0 - DbaMgr ver 0.60.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

Connecting to MDF file over Workgroup

Hi

I've build a client management (Windows) application in VS2005 which works fine on the local development machine but falls over when trying to connect to the SQL Server Express file located on a second machine on the same Workgroup. Several of the apllications will connect to the database file from networked computers.

The error I get when testing the connection or trying to connect via the App is:

-------------------
The file "Z:\BushBreaks.MDF" is on a network path that is not supported for database files.
An attempt to attach and auto-named database for file z:\bushbreaks.mdf failed. A database with the same name exists, or specified file cannot be opened or it is on a UNC share.
-------------------

How can I configure this database and/or connection to be able to allow connections to the MDF file? Please note that security is not an issue if that is at all relevant.

Many Thanks
John

Current you can't use remote database file in your SQL connection. Here is a instruction about AttachDBFileName property in connection string from MSDN:

The name of the primary database file, including the full path name of an attachable database. The path may be absolute or relative by using the DataDirectory substitution string. If DataDirectory is used, the database file must exist within a subdirectory of the directory pointed to by the substitution string.

Note:

Remote server, HTTP, and UNC path names are not supported.

For more information, you can refer to:

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx

Connecting to Local Database after Application Install

I have created an application which uses a SQL Express database. The program runs fine on the the computer where I built the app, however when I install the app on another computer I get an error telling me that under default SQL Express does not allow remote connections. The problem is that I dont want a remote connection I want a local connection, the database file is on the commputer. How can do get my application to look for the database on the local machine.

My connection string is:

Data Source=(local)\SQLEXPRESS;Initial Catalog="C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\PLDAQ.MDF";Integrated Security=True

I have made sure that the file is in the correct directory.

Any help would be greatly appretiated

hi,

the folder you are referencing is not a "standard" one in the "traditional" sense of SQL Server, and you can get problems if the account running the instance is not able to access that path... and anyway you should reference the intital catalog in the connection string via the "logical" name and not the physical primary data file name, thus
Data Source=(local)\SQLEXPRESS;Initial Catalog=dbLogicalFileName;Integrated Security=True
or use the AttachDBFilename feature of the User Instances mode..

try modifying the connection string to see if you are granted connection to the instance you are dealing with, as the exception you are reporting is quite a generic connection exception..

regards

|||

Andrea

I still have the same problem, I have updated my connection string to this:

Data Source = .\SQLEXPRESS;AttachDBFilename = [DataDirectory]\PLDaq.mdf;Integrated Security = True; UserInstance = False

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer, this however, as I am sure you will agree, is only temporary as I don't want to have to change the name of every computer that I install this application on, what do I need to do to rectify this situation.

|||

hi,

as you are not using "User Instances", I'd not go for the AttachDBFileName property of the connection string.. I'd attach/create the database once and then I'd go for the "traditional" Database=yourDbName property of the connection string...

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

what is your |DataDirectory| value?

regards

|||

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

I have tryed the traditional Database = yourDbName and that causes the same problem

Also There may come a time when I want to use User Instances, but for the time being I just want the thing to work.

|||

PEng1 wrote:

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

the fix is using

Data Source = .\SQLEXPRESS or Data Source = (Local)\SQLEXPRESS property in the connection string...

here you have to specify the instance you have to connect to, and you can provide "." and/or "(Local)" for "local" connections"...

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

pay attention to your "custom data folder"... consider that the account running the SQLExpress intstance required adeguate NTFS permissions to that folder.. and consider Vista "headaches"/requirements with regard writing in Program Files folder...

regards

|||

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

|||

hi,

PEng1 wrote:

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

start reading at http://technet.microsoft.com/en-us/windowsvista/aa905108.aspx, http://technet.microsoft.com/en-us/windowsvista/aa906021.aspx, ....

and look in this forum for Vista troubles with UAC..

regards

Connecting to Local Database after Application Install

I have created an application which uses a SQL Express database. The program runs fine on the the computer where I built the app, however when I install the app on another computer I get an error telling me that under default SQL Express does not allow remote connections. The problem is that I dont want a remote connection I want a local connection, the database file is on the commputer. How can do get my application to look for the database on the local machine.

My connection string is:

Data Source=(local)\SQLEXPRESS;Initial Catalog="C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\PLDAQ.MDF";Integrated Security=True

I have made sure that the file is in the correct directory.

Any help would be greatly appretiated

hi,

the folder you are referencing is not a "standard" one in the "traditional" sense of SQL Server, and you can get problems if the account running the instance is not able to access that path... and anyway you should reference the intital catalog in the connection string via the "logical" name and not the physical primary data file name, thus
Data Source=(local)\SQLEXPRESS;Initial Catalog=dbLogicalFileName;Integrated Security=True
or use the AttachDBFilename feature of the User Instances mode..

try modifying the connection string to see if you are granted connection to the instance you are dealing with, as the exception you are reporting is quite a generic connection exception..

regards

|||

Andrea

I still have the same problem, I have updated my connection string to this:

Data Source = .\SQLEXPRESS;AttachDBFilename = [DataDirectory]\PLDaq.mdf;Integrated Security = True; UserInstance = False

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer, this however, as I am sure you will agree, is only temporary as I don't want to have to change the name of every computer that I install this application on, what do I need to do to rectify this situation.

|||

hi,

as you are not using "User Instances", I'd not go for the AttachDBFileName property of the connection string.. I'd attach/create the database once and then I'd go for the "traditional" Database=yourDbName property of the connection string...

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

what is your |DataDirectory| value?

regards

|||

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

I have tryed the traditional Database = yourDbName and that causes the same problem

Also There may come a time when I want to use User Instances, but for the time being I just want the thing to work.

|||

PEng1 wrote:

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

the fix is using

Data Source = .\SQLEXPRESS or Data Source = (Local)\SQLEXPRESS property in the connection string...

here you have to specify the instance you have to connect to, and you can provide "." and/or "(Local)" for "local" connections"...

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

pay attention to your "custom data folder"... consider that the account running the SQLExpress intstance required adeguate NTFS permissions to that folder.. and consider Vista "headaches"/requirements with regard writing in Program Files folder...

regards

|||

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

|||

hi,

PEng1 wrote:

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

start reading at http://technet.microsoft.com/en-us/windowsvista/aa905108.aspx, http://technet.microsoft.com/en-us/windowsvista/aa906021.aspx, ....

and look in this forum for Vista troubles with UAC..

regards

Connecting to Local Database after Application Install

I have created an application which uses a SQL Express database. The program runs fine on the the computer where I built the app, however when I install the app on another computer I get an error telling me that under default SQL Express does not allow remote connections. The problem is that I dont want a remote connection I want a local connection, the database file is on the commputer. How can do get my application to look for the database on the local machine.

My connection string is:

Data Source=(local)\SQLEXPRESS;Initial Catalog="C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\PLDAQ.MDF";Integrated Security=True

I have made sure that the file is in the correct directory.

Any help would be greatly appretiated

hi,

the folder you are referencing is not a "standard" one in the "traditional" sense of SQL Server, and you can get problems if the account running the instance is not able to access that path... and anyway you should reference the intital catalog in the connection string via the "logical" name and not the physical primary data file name, thus
Data Source=(local)\SQLEXPRESS;Initial Catalog=dbLogicalFileName;Integrated Security=True
or use the AttachDBFilename feature of the User Instances mode..

try modifying the connection string to see if you are granted connection to the instance you are dealing with, as the exception you are reporting is quite a generic connection exception..

regards

|||

Andrea

I still have the same problem, I have updated my connection string to this:

Data Source = .\SQLEXPRESS;AttachDBFilename = [DataDirectory]\PLDaq.mdf;Integrated Security = True; UserInstance = False

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer, this however, as I am sure you will agree, is only temporary as I don't want to have to change the name of every computer that I install this application on, what do I need to do to rectify this situation.

|||

hi,

as you are not using "User Instances", I'd not go for the AttachDBFileName property of the connection string.. I'd attach/create the database once and then I'd go for the "traditional" Database=yourDbName property of the connection string...

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

what is your |DataDirectory| value?

regards

|||

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

I have tryed the traditional Database = yourDbName and that causes the same problem

Also There may come a time when I want to use User Instances, but for the time being I just want the thing to work.

|||

PEng1 wrote:

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

the fix is using

Data Source = .\SQLEXPRESS or Data Source = (Local)\SQLEXPRESS property in the connection string...

here you have to specify the instance you have to connect to, and you can provide "." and/or "(Local)" for "local" connections"...

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

pay attention to your "custom data folder"... consider that the account running the SQLExpress intstance required adeguate NTFS permissions to that folder.. and consider Vista "headaches"/requirements with regard writing in Program Files folder...

regards

|||

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

|||

hi,

PEng1 wrote:

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

start reading at http://technet.microsoft.com/en-us/windowsvista/aa905108.aspx, http://technet.microsoft.com/en-us/windowsvista/aa906021.aspx, ....

and look in this forum for Vista troubles with UAC..

regards

Sunday, March 11, 2012

Connecting to Linked Servers

I know this is an easy one for most of you but this is new territory for me.

I am trying to link a production application database to an existing SMS database.

Both of these databases are SQL 2000. I have sa access to both of them.

I have an accreditation application that deals with internal processes within our active directory network. We are using SMS database collections to provide the discovery for reporting of this application database and I want to compare the collection to the existing data between the 2 databases.

For simplicity I will define them both.

Application Database we will call “A-Database”

SMS Database we will call “B-Database”

I have gone into the A-Database and gone to linked Servers under the security node in enterprise manager. I created a new linked database and selected the SQL Server option in the general Tab.

In the Security Tab I selected the “Be made using the security context” and used “sa” for the Remote login and the CORRECT sa password for the With password option.

The server options tab remain the same with ”RPC, RPC Out, & Use Remote Collation” selected.

It appears to connect but there is not any Table or Views showing up. What am I doing wrong here and what do I need to do to link these 2 database engines so I can move forward?

Thanks,

Gene Godsey

In the properties of the Linked Servers I am looking at trying to change my connection by selecting the general tab and selecting the option for Other Data Sources. I have selected the Microsoft OLE DB Provider for SQL Server and then I have to provide data for 3 fields.

In the Product Name field I just put the database name I want to use from the server. In the Data Source name I insert serverName\DataSource name.

The Privider string has me stumped.

The location is grayed out but I believe that this will open up when I have a provider name. I do not know what goes there either.

It says that the catelog name is optional. I am not worried about that field.

Any suggestions.

Thanks,

|||Hi Geneway,

Im not sure why you are putting the DB name in the Product Name? I dont understand that bit. Where is it saying Product Name?

Your datasource would be the server name.

Your catalog would be the database.

Keep us updated.

Barry Andrew (Pace)|||

In the enterprise manager of SQL 2000 go to the security node. Under this you would go to the linked servers. If there is a linked server I would right click and select the properties link.

When the properties dialog box opens there are 3 tabs. General/Security/Server Options.

I select the General tab and the\n I will select the “Other Data Source” option.

From here I would select the “Microsoft OLE DB Provider for SQL Server” Dropdown. At this point there are 3 text boxes that are available to insert data.

1: Product name:

2: Data Source:

3: Provider String:

I must have this information incorrect because I cannot see tables or view from this.

I have tried to select the SQL Server option but I cannot control what database that is selected in that option.

Any suggestions,

Thanks,

|||Hi,

Do as you have been doing and use the following;

1) SQL Server - this will do fine
2) NetworkNameHere!!! - IE the server name the sql database is running on
3) a) Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
b)Provider=sqloledb;Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

A and B are trusted and standard authentication methods respectively

You may also find the website; www.connectionstrings.com useful.

hth

Pace|||

I figured it out!

YEA!!!!!

I created an datareader account in the SMS database. I selected the connect to SQL Server option button in the general tab location.

Under security I selected the sa account but the remopte user was the datareader account that I created in the SMS Database. It was really easy but this is not very well documented.

Thursday, March 8, 2012

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 remote sql server problems, please help

I am currently developing a 2.0 asp.net application from my home pc (Windows XP) and am trying to connect to a sql server on my host. This works fine at work but at home I just get the following error message:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Any ideas, i have even tried disabling my firewall to see if that made a difference.

Your help is much appreciated.

Under SQL2005 program menu follow configuration Tools =>SQL Server Surface Area Configuration => Select Server Surface Area Configuration for Services and Connections.

It will lead to a window with a treeview select Remote connections.Then Select Local and Remote Connections.

Thats it now you can connect your SQL Server without any problem

|||

Thanks for the reply, however, it seems as if the problem was with the router i was using. After making some port changes it works just fine.

Thanks