Wednesday, March 28, 2012

How to connect to the SQl server EXPRESS using 'ODBC Data Source A

Hi All,
Recently I have installed SQl server express edition. I was able to connect
to the SQL server from my .NET project using connection parameter like:
Data Source=. \SQLEXPRESS;AttachDbFilename=C:\Document
s and Settings\Raju\My
Documents\Sanjib SQL DBs\IBuyAdventure\IBuyAdventure.mdf;Integrated
Security=True;Connect Timeout=30;User Instance=True
Now I need to connect to the same SQL server from 'ODBC Data Source
Aministrator' wizard, that I am unable to do. The wizard is asking me (for
system DSn and File DSN) for SQL server name (I do no know what to give, is
it (local) or something) and how to login authenticate (with windows
authentication or something). Now if I goto Services/SQl Server (SQLEXPRESS)
, click LogOn I see that 'Local System Account' is checked. Pls tell me how
to connect to this SQl server using System DSN connection wizard.
By the way I am the administrator of this machine where I have instlled the
SQl server...
Thanks in advance,
--
Sanjib SahaHi
VB.NET
Imports System.Data.Odbc
Dim oODBCConnection As OdbcConnection
Dim ConnString As String = _
"Driver={SQL Server};" & _
"Server=SQLServerName;" & _
"Database=DatabaseName;" & _
"Uid=Username;" & _
"Pwd=Password"
oODBCConnection = New Odbc.OdbcConnection(ConnString)
oODBCConnection.Open()
"sanjib" <sanjib@.discussions.microsoft.com> wrote in message
news:7BE14AB4-9460-4489-B7CB-62880592EFC6@.microsoft.com...
> Hi All,
> Recently I have installed SQl server express edition. I was able to
> connect
> to the SQL server from my .NET project using connection parameter like:
> Data Source=. \SQLEXPRESS;AttachDbFilename=C:\Document
s and
> Settings\Raju\My
> Documents\Sanjib SQL DBs\IBuyAdventure\IBuyAdventure.mdf;Integrated
> Security=True;Connect Timeout=30;User Instance=True
> Now I need to connect to the same SQL server from 'ODBC Data Source
> Aministrator' wizard, that I am unable to do. The wizard is asking me (for
> system DSn and File DSN) for SQL server name (I do no know what to give,
> is
> it (local) or something) and how to login authenticate (with windows
> authentication or something). Now if I goto Services/SQl Server
> (SQLEXPRESS)
> , click LogOn I see that 'Local System Account' is checked. Pls tell me
> how
> to connect to this SQl server using System DSN connection wizard.
> By the way I am the administrator of this machine where I have instlled
> the
> SQl server...
> Thanks in advance,
> --
> Sanjib Saha|||The OP indicates that he is using SQL Server 2005 Express' User Instance. I
do not think he can connect to User Instance through ODBC DSN Wizard (why
use ODBC anyway?). I am not should if it is possible to connect to SQL
Server Express' User Instance through OdbcConnection object in
System.Data.Odbc namespace, but it is certain your sample code will not.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23QvKqzLoGHA.4332@.TK2MSFTNGP03.phx.gbl...
> Hi
> VB.NET
> Imports System.Data.Odbc
> Dim oODBCConnection As OdbcConnection
> Dim ConnString As String = _
> "Driver={SQL Server};" & _
> "Server=SQLServerName;" & _
> "Database=DatabaseName;" & _
> "Uid=Username;" & _
> "Pwd=Password"
> oODBCConnection = New Odbc.OdbcConnection(ConnString)
> oODBCConnection.Open()
>
> "sanjib" <sanjib@.discussions.microsoft.com> wrote in message
> news:7BE14AB4-9460-4489-B7CB-62880592EFC6@.microsoft.com...
>|||Norman,
There should be some way to connect to the SQl server 2005 Express user
instance. I need to connect to this SQl server b'case one of my application
is demandint that...There should be some way, tht we do not know...Anyway
thanks...Someone pls guide me...
Thanks,
Sanjib
--
Sanjib Saha
"sanjib" wrote:

> Hi All,
> Recently I have installed SQl server express edition. I was able to connec
t
> to the SQL server from my .NET project using connection parameter like:
> Data Source=. \SQLEXPRESS;AttachDbFilename=C:\Document
s and Settings\Raju\M
y
> Documents\Sanjib SQL DBs\IBuyAdventure\IBuyAdventure.mdf;Integrated
> Security=True;Connect Timeout=30;User Instance=True
> Now I need to connect to the same SQL server from 'ODBC Data Source
> Aministrator' wizard, that I am unable to do. The wizard is asking me (for
> system DSn and File DSN) for SQL server name (I do no know what to give, i
s
> it (local) or something) and how to login authenticate (with windows
> authentication or something). Now if I goto Services/SQl Server (SQLEXPRES
S)
> , click LogOn I see that 'Local System Account' is checked. Pls tell me ho
w
> to connect to this SQl server using System DSN connection wizard.
> By the way I am the administrator of this machine where I have instlled th
e
> SQl server...
> Thanks in advance,
> --
> Sanjib Saha|||You can access an User Instance once it is started by specifying the Named
Pipe name for the instance but if you haven't already started the user
instance with a managed code connection, ODBC won't start it. If your main
application is using ODBC, I would recommend attaching the database to the
main instance so it is always running and the ODBC connection can find it.
There is more information on named instances and how to connect to them
here:
http://msdn.microsoft.com/sql/expre...expuserinst.asp
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"sanjib" <sanjib@.discussions.microsoft.com> wrote in message
news:2AB671B3-FEAD-49C9-A309-8DBF8BF07815@.microsoft.com...[vbcol=seagreen]
> Norman,
> There should be some way to connect to the SQl server 2005 Express user
> instance. I need to connect to this SQl server b'case one of my
> application
> is demandint that...There should be some way, tht we do not know...Anyway
> thanks...Someone pls guide me...
> Thanks,
> Sanjib
> --
> Sanjib Saha
>
> "sanjib" wrote:
>|||I agree with Roger.
If you HAVE to access the database on SQL Server Express via something other
than ADO.NET2.0's System.Data SqlClient namespace, why use User Instannce?
The whole point of using user instance is to limit the database setup/access
within current user's privilidge of access to the computer. If a user has to
use ODBC DSN Wizard, it may well requires the user has a bit more privilidge
that usual. Also, an user instance is not available to other user even the
other user uses the same computer.
"sanjib" <sanjib@.discussions.microsoft.com> wrote in message
news:2AB671B3-FEAD-49C9-A309-8DBF8BF07815@.microsoft.com...[vbcol=seagreen]
> Norman,
> There should be some way to connect to the SQl server 2005 Express user
> instance. I need to connect to this SQl server b'case one of my
> application
> is demandint that...There should be some way, tht we do not know...Anyway
> thanks...Someone pls guide me...
> Thanks,
> Sanjib
> --
> Sanjib Saha
>
> "sanjib" wrote:
>|||I think I may understand what you're asking now. You have two completely
unrelated elements in your posting. First you were able to use ADO.Net in
Visual Studio to create a database. This database was a user instance which
is why this came up in our answers. On a completely unrelated note you now
want to install a third party application that uses ODBC to connect to the
database.
Go into the Windows Control Panel and select Administrative Tools. One of
the tools is ODBC data sources. Select the System DSN or User DSN as
required for your application and click ADD. Select the SQL Native Client
Driver. Fill in a name which you get to choose (probably the application is
looking for a particular name), leave the description blank and put
.\SQLExpress in the server field. Select the defaults for the rest unless
you already know the database name you want to make your default database.
If not, the default will be "master".
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Norman Yuan" <NotReal@.NotReal.not> wrote in message
news:eQyQnkToGHA.956@.TK2MSFTNGP03.phx.gbl...
>I agree with Roger.
> If you HAVE to access the database on SQL Server Express via something
> other than ADO.NET2.0's System.Data SqlClient namespace, why use User
> Instannce? The whole point of using user instance is to limit the database
> setup/access within current user's privilidge of access to the computer.
> If a user has to use ODBC DSN Wizard, it may well requires the user has a
> bit more privilidge that usual. Also, an user instance is not available to
> other user even the other user uses the same computer.
>
> "sanjib" <sanjib@.discussions.microsoft.com> wrote in message
> news:2AB671B3-FEAD-49C9-A309-8DBF8BF07815@.microsoft.com...
>

No comments:

Post a Comment