Showing posts with label connection. Show all posts
Showing posts with label connection. Show all posts

Wednesday, March 21, 2012

ReInstall Sql Server

I lost access to sql server, "sa" is "Denied" "builtin"
is "Denied" before I have a login for a standart user but
I can't use it I get connection fail all the time. I want
to reinstall Sql Server am i going to lose the databases?
Is there any hope for this situation?
Please Help!!!!!!!!!
ShalomHello,
it depends on your NT-Account. If you have still access to the
server console you can login, shutdown the sql-services and
copy the database files to a secure place.
You can than use the rebuildm.exe tool to create new system-db's.
Reattach the user-db's and all is fine.
That would be my suggestion...but maybe some have a better one.
cu
p.s:
But how you have lost the rights?
You have made backups of your system and user databases?
"Shalom" <Telaviv7777777@.aol.com> wrote in message
news:009f01c3cbda$9c3c1c40$a301280a@.phx.gbl...
quote:

> I lost access to sql server, "sa" is "Denied" "builtin"
> is "Denied" before I have a login for a standart user but
> I can't use it I get connection fail all the time. I want
> to reinstall Sql Server am i going to lose the databases?
> Is there any hope for this situation?
> Please Help!!!!!!!!!
> Shalom
|||You have a couple of possible solutions.
1. Restore master from a backup
2. Rebuild master then re-attach the user databases.
3. Attempt a Windows NT Athenticated connection with the NT admin account
on the server.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||Hi Christian,
Thank You for trying to help.
1) I selected security from the console root I epanded the
server than selected security clcked on login than
selected "sa" than selected "denied" for "sa" user.
2)I did not make a backup.
Shalom
quote:

>--Original Message--
>Hello,
>
>it depends on your NT-Account. If you have still access

to the
quote:

>server console you can login, shutdown the sql-services

and
quote:

>copy the database files to a secure place.
>You can than use the rebuildm.exe tool to create new

system-db's.
quote:

>Reattach the user-db's and all is fine.
>That would be my suggestion...but maybe some have a

better one.
quote:

>cu
>p.s:
>But how you have lost the rights?
>You have made backups of your system and user databases?
>
>"Shalom" <Telaviv7777777@.aol.com> wrote in message
>news:009f01c3cbda$9c3c1c40$a301280a@.phx.gbl...
but[QUOTE]
want[QUOTE]
databases?[QUOTE]
>
>.
>

Tuesday, March 20, 2012

Reinitializing SqlCommand object

Hi All,
Can the same connection object and the command object be reinitialised and
re-used through-out the project? Is the code below permissible?
Dim DBConnection As SqlConnection
Dim oCmd As SqlCommand
Dim sStmt As String
DBConnection.Open()
sStmt = "select count(*)......"
oCmd = New SqlCommand(sStmt, DBConnection)
oCmd.CommandText = CommandType.Text
ocmd.ExecuteScalar()
.....
...
...
sStmt = "insert ..."
oCmd = New SqlCommand(sStmt, DBConnection)
oCmd.CommandText = CommandType.Text
DBConnection.Open()
ocmd.ExecuteNonQuery()
.....
...
...
sStmt = "update......"
oCmd = New SqlCommand(sStmt, DBConnection)
oCmd.CommandText = CommandType.Text
DBConnection.Open()
ocmd.ExecuteNonQuery()
.....
...
...
oCmd.Connection.Close()
Would previous instances of SqlCommand object be garbage collected
automatically?
kdkd,
This is a .NET question, not SQL Server, but I'll field it.

> Can the same connection object and the command object be
> reinitialised and re-used through-out the project?
First off, in your code, you are not reusing the *object* you are reusing
the *reference* (the variable name) . There is a difference.
Second, you say "through-out the project" which to me implies global usage.
That's a bad, bad, bad practice. Declare, instantiate, Open, Use, and then
Close your connection only when you need it. No more.
If you have a series of commands to execute one after another, the pattern I
would recommend is this:
Dim myCommand as SqlCommand
Dim myConnection as New SqlConnection(ConnectionString)
myConnection.Open()
myCommand = New SqlCommand(sql,myConnection)
myCommand.ExecuteNonQuery
myCommand = New SqlCommand(sql,myConnection)
myCommand.ExecuteNonQuery
...
myConnection.Close()

> Would previous instances of SqlCommand object be
> garbage collected automatically?
Garbage collection in .NET is not immediate. It's "when it gets to it." But
yes, it will be collected. "myConnection = nothing" is uneeded and not
recommended.
Even though a connection is automatically closed when GC'ed, I still
recommend an explicit "myConnection.Close()." This will free up the ADO.NET
connection pool.
And one final note, consider looking at MSDN naming guidelines. In .NET, we
do not use "sStmt" or "oCmd".
--Alex Papadimoulis
"kd" wrote:

> Hi All,
> Can the same connection object and the command object be reinitialised and
> re-used through-out the project? Is the code below permissible?
> Dim DBConnection As SqlConnection
> Dim oCmd As SqlCommand
> Dim sStmt As String
> DBConnection.Open()
> sStmt = "select count(*)......"
> oCmd = New SqlCommand(sStmt, DBConnection)
> oCmd.CommandText = CommandType.Text
> ocmd.ExecuteScalar()
> ......
> ....
> ....
> sStmt = "insert ..."
> oCmd = New SqlCommand(sStmt, DBConnection)
> oCmd.CommandText = CommandType.Text
> DBConnection.Open()
> ocmd.ExecuteNonQuery()
> ......
> ....
> ....
> sStmt = "update......"
> oCmd = New SqlCommand(sStmt, DBConnection)
> oCmd.CommandText = CommandType.Text
> DBConnection.Open()
> ocmd.ExecuteNonQuery()
> ......
> ....
> ....
> oCmd.Connection.Close()
> Would previous instances of SqlCommand object be garbage collected
> automatically?
> kd|||Hi Alex,
Thanks for the guidelines.
Regards,
kd
"Alex Papadimoulis" wrote:
> kd,
> This is a .NET question, not SQL Server, but I'll field it.
>
> First off, in your code, you are not reusing the *object* you are reusing
> the *reference* (the variable name) . There is a difference.
> Second, you say "through-out the project" which to me implies global usage
.
> That's a bad, bad, bad practice. Declare, instantiate, Open, Use, and then
> Close your connection only when you need it. No more.
> If you have a series of commands to execute one after another, the pattern
I
> would recommend is this:
> Dim myCommand as SqlCommand
> Dim myConnection as New SqlConnection(ConnectionString)
> myConnection.Open()
> myCommand = New SqlCommand(sql,myConnection)
> myCommand.ExecuteNonQuery
> myCommand = New SqlCommand(sql,myConnection)
> myCommand.ExecuteNonQuery
> ...
> myConnection.Close()
>
> Garbage collection in .NET is not immediate. It's "when it gets to it." Bu
t
> yes, it will be collected. "myConnection = nothing" is uneeded and not
> recommended.
> Even though a connection is automatically closed when GC'ed, I still
> recommend an explicit "myConnection.Close()." This will free up the ADO.NE
T
> connection pool.
> And one final note, consider looking at MSDN naming guidelines. In .NET, w
e
> do not use "sStmt" or "oCmd".
> --Alex Papadimoulis
>
> "kd" wrote:
>|||Hi,
Would you be able to provide links for naming guidelines in .NET?
Thanks
kd
"Alex Papadimoulis" wrote:
> kd,
> This is a .NET question, not SQL Server, but I'll field it.
>
> First off, in your code, you are not reusing the *object* you are reusing
> the *reference* (the variable name) . There is a difference.
> Second, you say "through-out the project" which to me implies global usage
.
> That's a bad, bad, bad practice. Declare, instantiate, Open, Use, and then
> Close your connection only when you need it. No more.
> If you have a series of commands to execute one after another, the pattern
I
> would recommend is this:
> Dim myCommand as SqlCommand
> Dim myConnection as New SqlConnection(ConnectionString)
> myConnection.Open()
> myCommand = New SqlCommand(sql,myConnection)
> myCommand.ExecuteNonQuery
> myCommand = New SqlCommand(sql,myConnection)
> myCommand.ExecuteNonQuery
> ...
> myConnection.Close()
>
> Garbage collection in .NET is not immediate. It's "when it gets to it." Bu
t
> yes, it will be collected. "myConnection = nothing" is uneeded and not
> recommended.
> Even though a connection is automatically closed when GC'ed, I still
> recommend an explicit "myConnection.Close()." This will free up the ADO.NE
T
> connection pool.
> And one final note, consider looking at MSDN naming guidelines. In .NET, w
e
> do not use "sStmt" or "oCmd".
> --Alex Papadimoulis
>
> "kd" wrote:
>|||kd,
[url]http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconnamingguidelines.asp[/u
rl]
-- Alex Papadimoulis
"kd" wrote:
> Hi,
> Would you be able to provide links for naming guidelines in .NET?
> Thanks
> kd
> "Alex Papadimoulis" wrote:
>

Wednesday, March 7, 2012

Registry configuration problems ?

Hi,

Quite new to SSIS am currently trying to set up a registry configuration which will hold a connection string which will enable the main SQL configurations for a package to load. I wish to put the registry entry under the HKEY_LOCAL_MACHINE directory or more precisely in a key such as below:

HKEY_LOCAL_MACHINE\SOFTWARE\My Company\My Project\ETLConfigDbString

Have set this key up with a default value of the connection string and an associated registry configuration with the above as the value in the regsitry entry box. This configuration is listed as the first configurartion for the package to ensure it gets applied before the SQL configuration loads.

However on load or execute I get a warning of the type

A configuration entry specifies a registry key that is not available. Check the registry to ensure that the key is there.

Are there any known problems with regsitry configurations or am I just missing something obvious here ?

Thanks

Right may have answered my own question. Digging around on tghe Net a bit more I think it's that you can only have a registry entry which is under HKEY_CURRENT_USER (or one of its subkeys). It also must have a value called Value which must be a DWORD or string.

Can someone confirm this is correct ? Was hoping to use the HKEY_LOCAL_MACHINE key as that's what our company already uses for other software values but obviously if SSIS is restricted to HKEY_CURRENT_USER then that's not going to work.

Thanks

|||From the example given in Books Online, it does appear that keys have to be located under HKEY_CURRENT_USER. However, the text isn't as clear as it could be, so I'm not sure this is a definitive answer.

|||

Thanks John. I couldn't get the HKEY_LOCAL_MACHINE key to work so I've switched to using a system enviroment variable instead now. Didn't want to use HKEY_CURRENT_USER as the SQL configuration database is always going to be the same regardless of who the user running the package is so it didn't seem a good solution to use HKEY_CURRENT_USER.

To be honest (IMO) it's not really paticularly good from a deployment/production point of view either. I was intending to supply our DBA with a .reg key they could run to set up the registry entry put obviously I can't do that if I have to use HKEY_CURRENT_USER as I don't know what the SQL Agent user GUID is going to be in the registry.

So all in all a system enviroment variable seemed a better solution.

|||

I prefer environment variables myself, or a single XML configuration file.

Registration from Enterprise Manager

Here is my problem:
I have a sqlserver SQLA which I have registered in EM with a sqlserver
authentication with a uid and password and that connection works fine. The
problem is that when I look at the security log of SQLA, i see continuous
failure audits but with a uid that I am logging in to my local machine with.
My question is that when I am choosing to use sqlserver authentication and
not windows authentication to connect to SQLA, how come it is in turn still
sending windows authentication requests at the same time.
Few thing that have led me to this is:
1.When I delete the sqlserver registration from EM, those failure audits
stop, so that nakes me sure that these are coming from EM only.
2. When I map a drive to SQLA with windows credentials, these failure audits
stop, which indicates that it is succeeding in windows authentication ,
thats why the audits stop.
Please let me know your thoughts?
What you are seeing is probably related to the polling that Enterprise
Manager does - it polls the SQL and related services on the servers
that you have registered. You can turn this off in Enterprise Manager
by going up to the menu to Tools and selecting Options. On the general
tab, you can remove the check for Server State Polling.
-Sue
On Fri, 10 Sep 2004 15:44:06 GMT, "Renu Doda" <r_doda@.hotmail.com>
wrote:

>Here is my problem:
>I have a sqlserver SQLA which I have registered in EM with a sqlserver
>authentication with a uid and password and that connection works fine. The
>problem is that when I look at the security log of SQLA, i see continuous
>failure audits but with a uid that I am logging in to my local machine with.
>My question is that when I am choosing to use sqlserver authentication and
>not windows authentication to connect to SQLA, how come it is in turn still
>sending windows authentication requests at the same time.
>Few thing that have led me to this is:
>1.When I delete the sqlserver registration from EM, those failure audits
>stop, so that nakes me sure that these are coming from EM only.
>2. When I map a drive to SQLA with windows credentials, these failure audits
>stop, which indicates that it is succeeding in windows authentication ,
>thats why the audits stop.
>Please let me know your thoughts?
>

Saturday, February 25, 2012

registering MSDE 2000 FROM SQL 2000

Hi There,

I have install msde in one computer and try to register from my sql server, the following error message is coming.

A connection could not be established to Cal-itimilsina (computer in which MSDE IS INSTALLED)

RESON: SQL SERVER DOES NOT EXIST OR ACCESS DENIED

CONNECTIONOPEN(CONNECT())

====

BUT THE MSDE IS RUNNING IN THE CLIENT MACHINE. Could any one please help me

Thanks.

Indra.Check this (http://www.microsoft.com/sql/msde/productinfo/features.asp) site, but in short, - Named Pipes is not supported on MSDE. You need to create an alias on your server for MSDE instance using TCP/IP protocol, and specify the alias during server registration in EM. You can also use the IP address for registration.|||Thanks, i will have a check now.|||Hi,

I setup alias with TCP/IP and try to connect with alias name as well with tcp/ip, but same error message is comming. by the way what cold be my instance, i just install msde with setup.exe from command prompt.

thanks for help|||Type "OSQL -L" in command window.|||Originally posted by rdjabarov
Type "OSQL -L" in command window.

it display the name of the sql server available inthe network.