|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
Yes, wrox books are quite sweet.
|
|
#3
|
|||
|
|||
|
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). |
|
#4
|
|||
|
|||
|
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? |
|
#5
|
|||
|
|||
|
Quote:
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. |
|
#6
|
|||
|
|||
|
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 |
|
#7
|
|||
|
|||
|
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. |
|
#8
|
|||
|
|||
|
*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. |
|
#9
|
|||
|
|||
|
Quote:
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > connection string |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|