dbTalk Databases Forums  

Cannot connect to database using osql with sa user

microsoft.public.sqlserver.tools microsoft.public.sqlserver.tools


Discuss Cannot connect to database using osql with sa user in the microsoft.public.sqlserver.tools forum.



Reply
 
Thread Tools Display Modes
  #121  
Old   
Rob Hill
 
Posts: n/a

Default Re: Cannot connect to database using osql with sa user - 07-14-2008 , 10:13 PM






The script is set tot sql 2000 compat because we have customers that are
running sql 2000.

Anyway, I did some testing and I believe that I had a typo in one of my
scripts.

Everything is working as it should.

I do appreciate your help.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote

Quote:
Rob,

Yes, no problem. I did not have your other script, of course, but just
accessing the database works fine.

Earlier I asked about your server's default collation, just in case it was
Case Sensitive, although I see no evidence in your code that you are
mixing up cases. Just another thing to think about.

Out of curiosity, are you running SQLCMD against a SQL Server 2000
database? (I ask because your script sets 8.0 compatibility.)
Nonetheless, I ran the script against SQL Server 2000 with no problem,
including the follow-on OSQL.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:uuSISme5IHA.4448 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
After doing so, were you able to connect to the database with osql.exe?

osql -S SERVER -U sa -P password -d dbname

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:uDIFvhe5IHA.3528 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Rob,

I ran a modified version of your script and it created NewDB just fine.
I don't have another idea of what the problem might be.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:O%231n3Kd5IHA.2072 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Ok - I made a mistake when typing in the database name.

The database does exist and does not error when I do

use NewDB
go

Sorry for the wrong left turn there.

Rob

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:%23f2kK5c5IHA.4268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Ha! I need to go back to sleep.

The GO command gives the following error.

C:\>osql -S SERVER -U sa -P password
1> use NewDB
2> go
Msg 911, Level 16, State 1, Server SERVER, Line 1
Could not locate entry in sysdatabases for database 'NewDB'. No entry
found with
that name. Make sure that the name is entered correctly.
1

Perhaps something is wrong with my db creation script. I have attached
it along with a cmd script to execute it.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:%23ZPuguc5IHA.300 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
Rob,

I sense your frustration, but I have a question. Did you do the
following:

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2
3> GO

If you did not do the GO, your "use NewDB" never executed. (Another
question, is your server using a case sensitive collation?)

RLF


"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:eCybjnc5IHA.2260 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
That's a good idea. I didn't think about that.

Here's the result.

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2

The database exists, and I can enter the use command without error,
but if
I specify the database on the command line

C:\>osql.exe -S SERVER -U sa -P password -d NewDB
Cannot open database "NewDB" requested by the login. The login
failed.

Thanks,

Rob

"Erland Sommarskog" <esquel (AT) sommarskog (DOT) se> wrote in message
news:Xns9ADB6C0715EB4Yazorman (AT) 127 (DOT) 0.0.1...
Rob Hill (robh71 (AT) nospam (DOT) nospam) writes:
The database does exist. Thanks for the drive by response.

The error message you indicates that the database is not
accessible. This
could be because it does not exist, or beause it is in single-user
mode.

Since we don't see your system and your actual command-line, we
cannot
help
you much more than this. But you could try:

OSQL -S SERVER -U sa -P pwd

Then at this prompt type USE followed by space. Then you copy and
paste
the
database name from the failed command line, press return and then
go, and
see what error message you may get now.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


















Reply With Quote
  #122  
Old   
Rob Hill
 
Posts: n/a

Default Re: Cannot connect to database using osql with sa user - 07-14-2008 , 10:13 PM






The script is set tot sql 2000 compat because we have customers that are
running sql 2000.

Anyway, I did some testing and I believe that I had a typo in one of my
scripts.

Everything is working as it should.

I do appreciate your help.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote

Quote:
Rob,

Yes, no problem. I did not have your other script, of course, but just
accessing the database works fine.

Earlier I asked about your server's default collation, just in case it was
Case Sensitive, although I see no evidence in your code that you are
mixing up cases. Just another thing to think about.

Out of curiosity, are you running SQLCMD against a SQL Server 2000
database? (I ask because your script sets 8.0 compatibility.)
Nonetheless, I ran the script against SQL Server 2000 with no problem,
including the follow-on OSQL.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:uuSISme5IHA.4448 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
After doing so, were you able to connect to the database with osql.exe?

osql -S SERVER -U sa -P password -d dbname

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:uDIFvhe5IHA.3528 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Rob,

I ran a modified version of your script and it created NewDB just fine.
I don't have another idea of what the problem might be.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:O%231n3Kd5IHA.2072 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Ok - I made a mistake when typing in the database name.

The database does exist and does not error when I do

use NewDB
go

Sorry for the wrong left turn there.

Rob

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:%23f2kK5c5IHA.4268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Ha! I need to go back to sleep.

The GO command gives the following error.

C:\>osql -S SERVER -U sa -P password
1> use NewDB
2> go
Msg 911, Level 16, State 1, Server SERVER, Line 1
Could not locate entry in sysdatabases for database 'NewDB'. No entry
found with
that name. Make sure that the name is entered correctly.
1

Perhaps something is wrong with my db creation script. I have attached
it along with a cmd script to execute it.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:%23ZPuguc5IHA.300 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
Rob,

I sense your frustration, but I have a question. Did you do the
following:

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2
3> GO

If you did not do the GO, your "use NewDB" never executed. (Another
question, is your server using a case sensitive collation?)

RLF


"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:eCybjnc5IHA.2260 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
That's a good idea. I didn't think about that.

Here's the result.

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2

The database exists, and I can enter the use command without error,
but if
I specify the database on the command line

C:\>osql.exe -S SERVER -U sa -P password -d NewDB
Cannot open database "NewDB" requested by the login. The login
failed.

Thanks,

Rob

"Erland Sommarskog" <esquel (AT) sommarskog (DOT) se> wrote in message
news:Xns9ADB6C0715EB4Yazorman (AT) 127 (DOT) 0.0.1...
Rob Hill (robh71 (AT) nospam (DOT) nospam) writes:
The database does exist. Thanks for the drive by response.

The error message you indicates that the database is not
accessible. This
could be because it does not exist, or beause it is in single-user
mode.

Since we don't see your system and your actual command-line, we
cannot
help
you much more than this. But you could try:

OSQL -S SERVER -U sa -P pwd

Then at this prompt type USE followed by space. Then you copy and
paste
the
database name from the failed command line, press return and then
go, and
see what error message you may get now.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


















Reply With Quote
  #123  
Old   
Rob Hill
 
Posts: n/a

Default Re: Cannot connect to database using osql with sa user - 07-14-2008 , 10:13 PM



The script is set tot sql 2000 compat because we have customers that are
running sql 2000.

Anyway, I did some testing and I believe that I had a typo in one of my
scripts.

Everything is working as it should.

I do appreciate your help.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote

Quote:
Rob,

Yes, no problem. I did not have your other script, of course, but just
accessing the database works fine.

Earlier I asked about your server's default collation, just in case it was
Case Sensitive, although I see no evidence in your code that you are
mixing up cases. Just another thing to think about.

Out of curiosity, are you running SQLCMD against a SQL Server 2000
database? (I ask because your script sets 8.0 compatibility.)
Nonetheless, I ran the script against SQL Server 2000 with no problem,
including the follow-on OSQL.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:uuSISme5IHA.4448 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
After doing so, were you able to connect to the database with osql.exe?

osql -S SERVER -U sa -P password -d dbname

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:uDIFvhe5IHA.3528 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Rob,

I ran a modified version of your script and it created NewDB just fine.
I don't have another idea of what the problem might be.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:O%231n3Kd5IHA.2072 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Ok - I made a mistake when typing in the database name.

The database does exist and does not error when I do

use NewDB
go

Sorry for the wrong left turn there.

Rob

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:%23f2kK5c5IHA.4268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Ha! I need to go back to sleep.

The GO command gives the following error.

C:\>osql -S SERVER -U sa -P password
1> use NewDB
2> go
Msg 911, Level 16, State 1, Server SERVER, Line 1
Could not locate entry in sysdatabases for database 'NewDB'. No entry
found with
that name. Make sure that the name is entered correctly.
1

Perhaps something is wrong with my db creation script. I have attached
it along with a cmd script to execute it.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:%23ZPuguc5IHA.300 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
Rob,

I sense your frustration, but I have a question. Did you do the
following:

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2
3> GO

If you did not do the GO, your "use NewDB" never executed. (Another
question, is your server using a case sensitive collation?)

RLF


"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:eCybjnc5IHA.2260 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
That's a good idea. I didn't think about that.

Here's the result.

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2

The database exists, and I can enter the use command without error,
but if
I specify the database on the command line

C:\>osql.exe -S SERVER -U sa -P password -d NewDB
Cannot open database "NewDB" requested by the login. The login
failed.

Thanks,

Rob

"Erland Sommarskog" <esquel (AT) sommarskog (DOT) se> wrote in message
news:Xns9ADB6C0715EB4Yazorman (AT) 127 (DOT) 0.0.1...
Rob Hill (robh71 (AT) nospam (DOT) nospam) writes:
The database does exist. Thanks for the drive by response.

The error message you indicates that the database is not
accessible. This
could be because it does not exist, or beause it is in single-user
mode.

Since we don't see your system and your actual command-line, we
cannot
help
you much more than this. But you could try:

OSQL -S SERVER -U sa -P pwd

Then at this prompt type USE followed by space. Then you copy and
paste
the
database name from the failed command line, press return and then
go, and
see what error message you may get now.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


















Reply With Quote
  #124  
Old   
Rob Hill
 
Posts: n/a

Default Re: Cannot connect to database using osql with sa user - 07-14-2008 , 10:13 PM



The script is set tot sql 2000 compat because we have customers that are
running sql 2000.

Anyway, I did some testing and I believe that I had a typo in one of my
scripts.

Everything is working as it should.

I do appreciate your help.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote

Quote:
Rob,

Yes, no problem. I did not have your other script, of course, but just
accessing the database works fine.

Earlier I asked about your server's default collation, just in case it was
Case Sensitive, although I see no evidence in your code that you are
mixing up cases. Just another thing to think about.

Out of curiosity, are you running SQLCMD against a SQL Server 2000
database? (I ask because your script sets 8.0 compatibility.)
Nonetheless, I ran the script against SQL Server 2000 with no problem,
including the follow-on OSQL.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:uuSISme5IHA.4448 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
After doing so, were you able to connect to the database with osql.exe?

osql -S SERVER -U sa -P password -d dbname

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:uDIFvhe5IHA.3528 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Rob,

I ran a modified version of your script and it created NewDB just fine.
I don't have another idea of what the problem might be.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:O%231n3Kd5IHA.2072 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Ok - I made a mistake when typing in the database name.

The database does exist and does not error when I do

use NewDB
go

Sorry for the wrong left turn there.

Rob

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:%23f2kK5c5IHA.4268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Ha! I need to go back to sleep.

The GO command gives the following error.

C:\>osql -S SERVER -U sa -P password
1> use NewDB
2> go
Msg 911, Level 16, State 1, Server SERVER, Line 1
Could not locate entry in sysdatabases for database 'NewDB'. No entry
found with
that name. Make sure that the name is entered correctly.
1

Perhaps something is wrong with my db creation script. I have attached
it along with a cmd script to execute it.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:%23ZPuguc5IHA.300 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
Rob,

I sense your frustration, but I have a question. Did you do the
following:

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2
3> GO

If you did not do the GO, your "use NewDB" never executed. (Another
question, is your server using a case sensitive collation?)

RLF


"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:eCybjnc5IHA.2260 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
That's a good idea. I didn't think about that.

Here's the result.

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2

The database exists, and I can enter the use command without error,
but if
I specify the database on the command line

C:\>osql.exe -S SERVER -U sa -P password -d NewDB
Cannot open database "NewDB" requested by the login. The login
failed.

Thanks,

Rob

"Erland Sommarskog" <esquel (AT) sommarskog (DOT) se> wrote in message
news:Xns9ADB6C0715EB4Yazorman (AT) 127 (DOT) 0.0.1...
Rob Hill (robh71 (AT) nospam (DOT) nospam) writes:
The database does exist. Thanks for the drive by response.

The error message you indicates that the database is not
accessible. This
could be because it does not exist, or beause it is in single-user
mode.

Since we don't see your system and your actual command-line, we
cannot
help
you much more than this. But you could try:

OSQL -S SERVER -U sa -P pwd

Then at this prompt type USE followed by space. Then you copy and
paste
the
database name from the failed command line, press return and then
go, and
see what error message you may get now.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


















Reply With Quote
  #125  
Old   
Rob Hill
 
Posts: n/a

Default Re: Cannot connect to database using osql with sa user - 07-14-2008 , 10:13 PM



The script is set tot sql 2000 compat because we have customers that are
running sql 2000.

Anyway, I did some testing and I believe that I had a typo in one of my
scripts.

Everything is working as it should.

I do appreciate your help.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote

Quote:
Rob,

Yes, no problem. I did not have your other script, of course, but just
accessing the database works fine.

Earlier I asked about your server's default collation, just in case it was
Case Sensitive, although I see no evidence in your code that you are
mixing up cases. Just another thing to think about.

Out of curiosity, are you running SQLCMD against a SQL Server 2000
database? (I ask because your script sets 8.0 compatibility.)
Nonetheless, I ran the script against SQL Server 2000 with no problem,
including the follow-on OSQL.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:uuSISme5IHA.4448 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
After doing so, were you able to connect to the database with osql.exe?

osql -S SERVER -U sa -P password -d dbname

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:uDIFvhe5IHA.3528 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Rob,

I ran a modified version of your script and it created NewDB just fine.
I don't have another idea of what the problem might be.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:O%231n3Kd5IHA.2072 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Ok - I made a mistake when typing in the database name.

The database does exist and does not error when I do

use NewDB
go

Sorry for the wrong left turn there.

Rob

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:%23f2kK5c5IHA.4268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Ha! I need to go back to sleep.

The GO command gives the following error.

C:\>osql -S SERVER -U sa -P password
1> use NewDB
2> go
Msg 911, Level 16, State 1, Server SERVER, Line 1
Could not locate entry in sysdatabases for database 'NewDB'. No entry
found with
that name. Make sure that the name is entered correctly.
1

Perhaps something is wrong with my db creation script. I have attached
it along with a cmd script to execute it.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:%23ZPuguc5IHA.300 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
Rob,

I sense your frustration, but I have a question. Did you do the
following:

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2
3> GO

If you did not do the GO, your "use NewDB" never executed. (Another
question, is your server using a case sensitive collation?)

RLF


"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:eCybjnc5IHA.2260 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
That's a good idea. I didn't think about that.

Here's the result.

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2

The database exists, and I can enter the use command without error,
but if
I specify the database on the command line

C:\>osql.exe -S SERVER -U sa -P password -d NewDB
Cannot open database "NewDB" requested by the login. The login
failed.

Thanks,

Rob

"Erland Sommarskog" <esquel (AT) sommarskog (DOT) se> wrote in message
news:Xns9ADB6C0715EB4Yazorman (AT) 127 (DOT) 0.0.1...
Rob Hill (robh71 (AT) nospam (DOT) nospam) writes:
The database does exist. Thanks for the drive by response.

The error message you indicates that the database is not
accessible. This
could be because it does not exist, or beause it is in single-user
mode.

Since we don't see your system and your actual command-line, we
cannot
help
you much more than this. But you could try:

OSQL -S SERVER -U sa -P pwd

Then at this prompt type USE followed by space. Then you copy and
paste
the
database name from the failed command line, press return and then
go, and
see what error message you may get now.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


















Reply With Quote
  #126  
Old   
Rob Hill
 
Posts: n/a

Default Re: Cannot connect to database using osql with sa user - 07-14-2008 , 10:13 PM



The script is set tot sql 2000 compat because we have customers that are
running sql 2000.

Anyway, I did some testing and I believe that I had a typo in one of my
scripts.

Everything is working as it should.

I do appreciate your help.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote

Quote:
Rob,

Yes, no problem. I did not have your other script, of course, but just
accessing the database works fine.

Earlier I asked about your server's default collation, just in case it was
Case Sensitive, although I see no evidence in your code that you are
mixing up cases. Just another thing to think about.

Out of curiosity, are you running SQLCMD against a SQL Server 2000
database? (I ask because your script sets 8.0 compatibility.)
Nonetheless, I ran the script against SQL Server 2000 with no problem,
including the follow-on OSQL.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:uuSISme5IHA.4448 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
After doing so, were you able to connect to the database with osql.exe?

osql -S SERVER -U sa -P password -d dbname

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:uDIFvhe5IHA.3528 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Rob,

I ran a modified version of your script and it created NewDB just fine.
I don't have another idea of what the problem might be.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:O%231n3Kd5IHA.2072 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Ok - I made a mistake when typing in the database name.

The database does exist and does not error when I do

use NewDB
go

Sorry for the wrong left turn there.

Rob

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:%23f2kK5c5IHA.4268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Ha! I need to go back to sleep.

The GO command gives the following error.

C:\>osql -S SERVER -U sa -P password
1> use NewDB
2> go
Msg 911, Level 16, State 1, Server SERVER, Line 1
Could not locate entry in sysdatabases for database 'NewDB'. No entry
found with
that name. Make sure that the name is entered correctly.
1

Perhaps something is wrong with my db creation script. I have attached
it along with a cmd script to execute it.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:%23ZPuguc5IHA.300 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
Rob,

I sense your frustration, but I have a question. Did you do the
following:

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2
3> GO

If you did not do the GO, your "use NewDB" never executed. (Another
question, is your server using a case sensitive collation?)

RLF


"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:eCybjnc5IHA.2260 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
That's a good idea. I didn't think about that.

Here's the result.

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2

The database exists, and I can enter the use command without error,
but if
I specify the database on the command line

C:\>osql.exe -S SERVER -U sa -P password -d NewDB
Cannot open database "NewDB" requested by the login. The login
failed.

Thanks,

Rob

"Erland Sommarskog" <esquel (AT) sommarskog (DOT) se> wrote in message
news:Xns9ADB6C0715EB4Yazorman (AT) 127 (DOT) 0.0.1...
Rob Hill (robh71 (AT) nospam (DOT) nospam) writes:
The database does exist. Thanks for the drive by response.

The error message you indicates that the database is not
accessible. This
could be because it does not exist, or beause it is in single-user
mode.

Since we don't see your system and your actual command-line, we
cannot
help
you much more than this. But you could try:

OSQL -S SERVER -U sa -P pwd

Then at this prompt type USE followed by space. Then you copy and
paste
the
database name from the failed command line, press return and then
go, and
see what error message you may get now.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


















Reply With Quote
  #127  
Old   
Rob Hill
 
Posts: n/a

Default Re: Cannot connect to database using osql with sa user - 07-14-2008 , 10:13 PM



The script is set tot sql 2000 compat because we have customers that are
running sql 2000.

Anyway, I did some testing and I believe that I had a typo in one of my
scripts.

Everything is working as it should.

I do appreciate your help.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote

Quote:
Rob,

Yes, no problem. I did not have your other script, of course, but just
accessing the database works fine.

Earlier I asked about your server's default collation, just in case it was
Case Sensitive, although I see no evidence in your code that you are
mixing up cases. Just another thing to think about.

Out of curiosity, are you running SQLCMD against a SQL Server 2000
database? (I ask because your script sets 8.0 compatibility.)
Nonetheless, I ran the script against SQL Server 2000 with no problem,
including the follow-on OSQL.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:uuSISme5IHA.4448 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
After doing so, were you able to connect to the database with osql.exe?

osql -S SERVER -U sa -P password -d dbname

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:uDIFvhe5IHA.3528 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Rob,

I ran a modified version of your script and it created NewDB just fine.
I don't have another idea of what the problem might be.

RLF

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:O%231n3Kd5IHA.2072 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
Ok - I made a mistake when typing in the database name.

The database does exist and does not error when I do

use NewDB
go

Sorry for the wrong left turn there.

Rob

"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:%23f2kK5c5IHA.4268 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Ha! I need to go back to sleep.

The GO command gives the following error.

C:\>osql -S SERVER -U sa -P password
1> use NewDB
2> go
Msg 911, Level 16, State 1, Server SERVER, Line 1
Could not locate entry in sysdatabases for database 'NewDB'. No entry
found with
that name. Make sure that the name is entered correctly.
1

Perhaps something is wrong with my db creation script. I have attached
it along with a cmd script to execute it.

Thanks,

Rob

"Russell Fields" <russellfields (AT) nomail (DOT) com> wrote in message
news:%23ZPuguc5IHA.300 (AT) TK2MSFTNGP05 (DOT) phx.gbl...
Rob,

I sense your frustration, but I have a question. Did you do the
following:

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2
3> GO

If you did not do the GO, your "use NewDB" never executed. (Another
question, is your server using a case sensitive collation?)

RLF


"Rob Hill" <robh71 (AT) nospam (DOT) nospam> wrote in message
news:eCybjnc5IHA.2260 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
That's a good idea. I didn't think about that.

Here's the result.

C:\>osql.exe -S SERVER -U sa -P password
1> use NewDB
2

The database exists, and I can enter the use command without error,
but if
I specify the database on the command line

C:\>osql.exe -S SERVER -U sa -P password -d NewDB
Cannot open database "NewDB" requested by the login. The login
failed.

Thanks,

Rob

"Erland Sommarskog" <esquel (AT) sommarskog (DOT) se> wrote in message
news:Xns9ADB6C0715EB4Yazorman (AT) 127 (DOT) 0.0.1...
Rob Hill (robh71 (AT) nospam (DOT) nospam) writes:
The database does exist. Thanks for the drive by response.

The error message you indicates that the database is not
accessible. This
could be because it does not exist, or beause it is in single-user
mode.

Since we don't see your system and your actual command-line, we
cannot
help
you much more than this. But you could try:

OSQL -S SERVER -U sa -P pwd

Then at this prompt type USE followed by space. Then you copy and
paste
the
database name from the failed command line, press return and then
go, and
see what error message you may get now.

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


















Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.