473,421 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,421 software developers and data experts.

sql connection string

Art
Hello again,

Can anyone tell me the correct connection string to use? My database is on
the E: drive of a remote server. I can either map a drive from my local
machine to it, or use the \\servername\ stuff.

I can't seem to get it right.

thanks,
Art
Nov 21 '05 #1
11 8045
I suppose you are using MS Access?

There's an easy way to create a connectionstring:
- Create a new textfile
- Rename it from 'New Text Document.txt' to 'Connection.udl' (the name
doesn' matter, the extension is the important part)
- Doubleclick on this file
- On the first tab (Provider) select 'Microsoft Jet 4.0 OLE DB Provider'
- Click the 'Next' button
- Browse to the database and select it
- Press the 'Test Connection' button, this should succeed
- Close the wizard
- Open the UDL file with notepad
- The last line is the connectionstring to use

Good luck!
--
Kind regards,

Ken Huysmans
http://www.khsw-be.net
Nov 21 '05 #2
www.connectionstrings.com <--- good site for this :)

--

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.ma.../13/63199.aspx
-------------------------------------------------------------------------------------------

"Art" <Ar*@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
Hello again,

Can anyone tell me the correct connection string to use? My database is
on
the E: drive of a remote server. I can either map a drive from my local
machine to it, or use the \\servername\ stuff.

I can't seem to get it right.

thanks,
Art

Nov 21 '05 #3
Art
Ken,

Can I do this with sql server? I'm not at work right now and can't test it
out till tomorrow. If this works with sql server it sounds great!

Art

"kHSw" wrote:
I suppose you are using MS Access?

There's an easy way to create a connectionstring:
- Create a new textfile
- Rename it from 'New Text Document.txt' to 'Connection.udl' (the name
doesn' matter, the extension is the important part)
- Doubleclick on this file
- On the first tab (Provider) select 'Microsoft Jet 4.0 OLE DB Provider'
- Click the 'Next' button
- Browse to the database and select it
- Press the 'Test Connection' button, this should succeed
- Close the wizard
- Open the UDL file with notepad
- The last line is the connectionstring to use

Good luck!
--
Kind regards,

Ken Huysmans
http://www.khsw-be.net

Nov 21 '05 #4
Art
Sahil,

Thanks for the response. I did go to connectionstrings. The problem that I
think I'm having is how to refer to the remote server, something that I
didn't get from connectionstrings.

Art

"Sahil Malik [MVP]" wrote:
www.connectionstrings.com <--- good site for this :)

--

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.ma.../13/63199.aspx
-------------------------------------------------------------------------------------------

"Art" <Ar*@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
Hello again,

Can anyone tell me the correct connection string to use? My database is
on
the E: drive of a remote server. I can either map a drive from my local
machine to it, or use the \\servername\ stuff.

I can't seem to get it right.

thanks,
Art


Nov 21 '05 #5
You can use the same method for every provider on your system (Oracle, SQL
Server, Access, Excel, ...)

- Select the provider for SQL Server
- Press the 'Next' button
- Enter the servername (*1)
- Specify username and password
- Check 'Allow saving password' (Select 'Yes' to the security warning when
pressing the OK button when finished)
- Select the database
- Test the connection
If you are using SQL Server you will be using the SQLClient, so remove the
Provider-part of the connectionstring

Provider=SQLOLEDB.1;Password=123;Persist Security Info=True;User
ID=sa;Initial Catalog=MyDatabase;Data Source=MyServer

should be

Password=123;Persist Security Info=True;User ID=sa;Initial
Catalog=MyDatabase;Data Source=MyServer
(*1) I'm a little bit confused because you told in your post your database
was on the E: drive of a remote server. That's why I thought you were using
Access.
For SQL Server it doesn't matter on what drive the database resides, you
should be able to connect using the servername...

--
Kind regards,

Ken Huysmans
http://www.khsw-be.net
"Art" wrote:
Ken,

Can I do this with sql server? I'm not at work right now and can't test it
out till tomorrow. If this works with sql server it sounds great!

Art

"kHSw" wrote:
I suppose you are using MS Access?

There's an easy way to create a connectionstring:
- Create a new textfile
- Rename it from 'New Text Document.txt' to 'Connection.udl' (the name
doesn' matter, the extension is the important part)
- Doubleclick on this file
- On the first tab (Provider) select 'Microsoft Jet 4.0 OLE DB Provider'
- Click the 'Next' button
- Browse to the database and select it
- Press the 'Test Connection' button, this should succeed
- Close the wizard
- Open the UDL file with notepad
- The last line is the connectionstring to use

Good luck!
--
Kind regards,

Ken Huysmans
http://www.khsw-be.net

Nov 21 '05 #6
Art,

If you have a database as MS-Access file than your DataBase is accessable
with its file name.

If you have a databaseserver as SQLServer than the database is accessable by
its servername or IP address.

This is a major difference between using (connecting to) databases.

This page probably is referenced the most times in these dotNet newsgroups

http://www.connectionstrings.com/

However, there is as well the very good

http://www.carlprothman.net/Default.aspx?tabid=81

I hope this helps a little bit?

Cor


Nov 21 '05 #7
Art
Ken,

That was fantastic! It worked wonderfully. Thanks very much.

Art

"kHSw" wrote:
You can use the same method for every provider on your system (Oracle, SQL
Server, Access, Excel, ...)

- Select the provider for SQL Server
- Press the 'Next' button
- Enter the servername (*1)
- Specify username and password
- Check 'Allow saving password' (Select 'Yes' to the security warning when
pressing the OK button when finished)
- Select the database
- Test the connection
If you are using SQL Server you will be using the SQLClient, so remove the
Provider-part of the connectionstring

Provider=SQLOLEDB.1;Password=123;Persist Security Info=True;User
ID=sa;Initial Catalog=MyDatabase;Data Source=MyServer

should be

Password=123;Persist Security Info=True;User ID=sa;Initial
Catalog=MyDatabase;Data Source=MyServer
(*1) I'm a little bit confused because you told in your post your database
was on the E: drive of a remote server. That's why I thought you were using
Access.
For SQL Server it doesn't matter on what drive the database resides, you
should be able to connect using the servername...

--
Kind regards,

Ken Huysmans
http://www.khsw-be.net
"Art" wrote:
Ken,

Can I do this with sql server? I'm not at work right now and can't test it
out till tomorrow. If this works with sql server it sounds great!

Art

"kHSw" wrote:
I suppose you are using MS Access?

There's an easy way to create a connectionstring:
- Create a new textfile
- Rename it from 'New Text Document.txt' to 'Connection.udl' (the name
doesn' matter, the extension is the important part)
- Doubleclick on this file
- On the first tab (Provider) select 'Microsoft Jet 4.0 OLE DB Provider'
- Click the 'Next' button
- Browse to the database and select it
- Press the 'Test Connection' button, this should succeed
- Close the wizard
- Open the UDL file with notepad
- The last line is the connectionstring to use

Good luck!
--
Kind regards,

Ken Huysmans
http://www.khsw-be.net

Nov 21 '05 #8

"Art" <Ar*@discussions.microsoft.com> wrote in message
news:1F**********************************@microsof t.com...
Ken,

That was fantastic! It worked wonderfully. Thanks very much.

Art

You're welcome!
Nov 21 '05 #9
in addition to Cor`s comment

it is still possible to dynamicly load a sql server database file

even better i once released an app that read a sql server database from a
DVD even that is possible
just as with an MDB database file, when you are using the file-based
approach you can include a path to the physical file in the connection
string for the new AttachDBFileName parameter:
Dim ConnStr as string = "Data Source=.\SQLExpress; Initial Catalog=;
Integrated Security=true; AttachDBFileName="X:\MyDb.mdf "

Connecting with this connection string causes the file MyDb.mdf to be
automatically attached to the SQLExpress instance. When the application
ends, it will automatically be detached and therefore not locked and
available for copying.

ps. my favorite refernce is

http://www.carlprothman.net however i liked his website more in the
able-consulting days ( looked nicer to me )

regards

Michel Posseth [MCP]

"Cor Ligthert [MVP]" <no************@planet.nl> schreef in bericht
news:u8**************@TK2MSFTNGP14.phx.gbl...
Art,

If you have a database as MS-Access file than your DataBase is accessable
with its file name.

If you have a databaseserver as SQLServer than the database is accessable
by its servername or IP address.

This is a major difference between using (connecting to) databases.

This page probably is referenced the most times in these dotNet newsgroups

http://www.connectionstrings.com/

However, there is as well the very good

http://www.carlprothman.net/Default.aspx?tabid=81

I hope this helps a little bit?

Cor

Nov 21 '05 #10
Art
Cor,

Thanks again for your help!

Art

"Cor Ligthert [MVP]" wrote:
Art,

If you have a database as MS-Access file than your DataBase is accessable
with its file name.

If you have a databaseserver as SQLServer than the database is accessable by
its servername or IP address.

This is a major difference between using (connecting to) databases.

This page probably is referenced the most times in these dotNet newsgroups

http://www.connectionstrings.com/

However, there is as well the very good

http://www.carlprothman.net/Default.aspx?tabid=81

I hope this helps a little bit?

Cor


Nov 21 '05 #11
Art
Michael,

Thanks for additional information.

Art

"m.posseth" wrote:
in addition to Cor`s comment

it is still possible to dynamicly load a sql server database file

even better i once released an app that read a sql server database from a
DVD even that is possible
just as with an MDB database file, when you are using the file-based
approach you can include a path to the physical file in the connection
string for the new AttachDBFileName parameter:
Dim ConnStr as string = "Data Source=.\SQLExpress; Initial Catalog=;
Integrated Security=true; AttachDBFileName="X:\MyDb.mdf "

Connecting with this connection string causes the file MyDb.mdf to be
automatically attached to the SQLExpress instance. When the application
ends, it will automatically be detached and therefore not locked and
available for copying.

ps. my favorite refernce is

http://www.carlprothman.net however i liked his website more in the
able-consulting days ( looked nicer to me )

regards

Michel Posseth [MCP]

"Cor Ligthert [MVP]" <no************@planet.nl> schreef in bericht
news:u8**************@TK2MSFTNGP14.phx.gbl...
Art,

If you have a database as MS-Access file than your DataBase is accessable
with its file name.

If you have a databaseserver as SQLServer than the database is accessable
by its servername or IP address.

This is a major difference between using (connecting to) databases.

This page probably is referenced the most times in these dotNet newsgroups

http://www.connectionstrings.com/

However, there is as well the very good

http://www.carlprothman.net/Default.aspx?tabid=81

I hope this helps a little bit?

Cor


Nov 21 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: AMC | last post by:
Hi, I'm using an include file to store the connection string to a database. Whenever I try to reference that string to open a connection in the page that includes the file I get the error 'empy...
0
by: Jay Douglas | last post by:
Hello, I'm trying to create a Data Links Property window that behaves just like the dialog box in Visual Studio .Net for MS Sql Server connections. I've found a lot of examples that use...
5
by: Matt | last post by:
Hello, What is the best way to handle the database connection string for a class library project that will be compiled and used as a .dll? This .dll will be accessed via classic ASP and in...
37
by: sam44 | last post by:
Hi, At startup the user log on and chooses the name of a client from a dropdownlist, which then changes dynamically the connection string (the name of the client indicates which database to use)....
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
3
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable...
6
Cintury
by: Cintury | last post by:
Hi all, I've developed a mobile application for windows mobile 5.0 that has been in use for a while (1 year and a couple of months). It was developed in visual studios 2005 with a back-end sql...
0
by: Robert Avery | last post by:
In VBA/VB6, I had a class (incomplete sample below) that watched and displayed for the user all connection events, so that I could easily see what SQL was taking a long time, and when it freezes, I...
2
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.