SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 9th, 2003, 12:37 AM
zimm zimm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 30 zimm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
connection string

I've seen a few people who are unfamiliar with MS ODBC technology, and just wanted to throw this out there for them to use.

One of the hardest things for me to learn at first was how to build a connection string to a database. There's quite a bit of info that can be put in a connection string, and the easiest way to get there is like this.

right click (in the folder where your DB resides), then click "add new">>"text file". Name it what you want, but instead of using .txt for it's file type, make it a .udl (don't ask what it stands for). Windows will ask if you are sure you want to change the file extension. Click yes.

Double click on the UDL file and a dialogue box titled "Data Link Properties" will pop up. It defaults to the connection tab, but you need to first go to the "provider" tab.

Select the proper provider (MS JET 3.51, MS HET 4.0, or MS OLE DB PROVIDER for SQL Server), then click "next".

If you're using access, just browse to the database. Put in your account name and password, then click "Test Connection". If the connection succeeds, then click "OK" on the bottom.

If you're using SQL Server, under the "Connection" tab, use the drop-down to select the correct server. Enter the correct security information, then select the proper database. Finally, test the connection. If it succeeds, then just click OK.

Now, right click on the .udl file, and select "Open with". Use notepad to open it. When notepad opens the file, you will see 3 lines. The third line is the whole connection string. Copy and paste it as the argument for the connection.open method.

Works every time

Reply With Quote
  #2  
Old August 22nd, 2003, 02:01 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
Yes, wrox books are quite sweet.

Reply With Quote
  #3  
Old August 22nd, 2003, 05:28 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,716 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 33 m 54 sec
Reputation Power: 688
msdn library

If you use this method, the connection string will be from your computer to the database. You won't be able to use this to create a remote webserver connection string (unless you have access to the console there).

Reply With Quote
  #4  
Old August 22nd, 2003, 05:56 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
did it originate in MSDN? haha, it makes you wonder how many times this has been ripped off without correct quoting.

umm... thanks for that tidbit i guess?

Reply With Quote
  #5  
Old August 22nd, 2003, 07:11 PM
zimm zimm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 30 zimm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Quote:
Originally posted by Doug G
msdn library

If you use this method, the connection string will be from your computer to the database. You won't be able to use this to create a remote webserver connection string (unless you have access to the console there).


Actually, if you are making a DSNless connection to MS SQL Server or Oracle, it would work from any client in the network.

I had no idea that this was in MSDN or Wrox. A technical manager from a couple of employers ago showed it to me.

Reply With Quote
  #6  
Old August 22nd, 2003, 09:43 PM
aspman aspman is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Ashburn,VA
Posts: 105 aspman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 22 m 40 sec
Reputation Power: 5
Smile

FYI

UDL : Universal Data Link.

Not that everyone doesnot know. But it would be good to know what it is when doing something. Also for quick reference

Reply With Quote
  #7  
Old August 22nd, 2003, 10:20 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,716 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 33 m 54 sec
Reputation Power: 688
http://support.microsoft.com/defaul...s/Q264/6/91.ASP

And yes with a server-based dbms that you connect up to with tcp/ip you can probably use the connection string you make on your workstation on the web server. I was thinking mostly of Access, where you will have to edit the path to the .mdb file unless your web server has an identical file structure and file location.

Reply With Quote
  #8  
Old August 23rd, 2003, 12:12 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
*shrivers*... access.....

i hope when you think db, the first thing that comes to your mind isn't access....

Last edited by unatratnag : August 23rd, 2003 at 06:21 AM.

Reply With Quote
  #9  
Old August 24th, 2003, 02:48 PM
zimm zimm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 30 zimm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Quote:
Originally posted by Doug G
http://support.microsoft.com/defaul...s/Q264/6/91.ASP

And yes with a server-based dbms that you connect up to with tcp/ip you can probably use the connection string you make on your workstation on the web server. I was thinking mostly of Access, where you will have to edit the path to the .mdb file unless your web server has an identical file structure and file location.


Matter of fact, I had to get around that very thing on a web site I'm working on.

Solution: create two session-level variables for the connection string, one for the production location and one for the development location. In development, comment out the production one; in production, comment out the development one.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > connection string


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway