473,322 Members | 1,431 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,322 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 8037
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.