Showing posts with label default. Show all posts
Showing posts with label default. Show all posts

Tuesday, February 14, 2012

Connecting to SQL via ODBC : How to change the default database configured with DSN

Hello All,

Does anybody know how to achive that?

<

addname="ConnectionString"connectionString="Dsn=dsn_name;uid=user;pwd=password"providerName="System.Data.Odbc" />

I have got this created by the wizard for my sqlDataSource. I am able to get data from tables in the default database specified with the DSN.

But I want to go to other database than the default.

Thanks a lot in advamce for your help!

Kazu

DSN is tied to a particular database, which in your case is the default database. You can either a) create a new DSN and link it with the database you want to connect with or b) rewrite the connection string so that you aren't using a DSN. this link should help you write the connection stringhttp://www.sqlstrings.com/SQL-Server-connection-strings.htmhttp://www.sqlstrings.com/SQL-Server-connection-strings.htm

|||

thanks. But..

> DSN is tied to a particular database...

Not really. I have finally achived what I wanted, by simply adding "Database=" parameter to the connectionstring.

|||

> DSN is tied to a particulardefault database... Wink

Sunday, February 12, 2012

Connecting to SQL Server on a different port

I have a server running SQL Server 2005 Dev behind a firewall that blocks the default SQL Server port. So, I changed the port that SQL server uses to another port. How do I connect to the database instance with SQL Server Management Studio. I have tried:

xxx.xxx.xxx.xxx\MSSQLSERVER
xxx.xxx.xxx.xxx:port\MSSQLSERVER

name.of.machine\MSSQLSERVER

On all of these, I get an error 25 - Connection string is not valid. I have the surface area configured correctly (i.e. named pipes and TCP/IP are both turned on), and the sql server browser is running. I can ping the server just fine, and when I go to GRC.com and do a shields up report it lists my port of choice as being open.

What am I missing?

I also set the native client configuration's default port to the port I want to connect to, and it appears that that didn't work either.

Ideas? I would like to get this running ASAP.

Thanks in advance!Also, opening up that port on the firewall is not an option. I don't have access to the firewall. I'm doing this for a school project, and I have to work under their restrictions.|||

Use server="servername,port_number" (take note of the comma)

Or,you can create a DNS entry that defines the server name and IP address combination. This is normally done on the DNS server. Just make sure that this entry is allowed in your firewall

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