?
Solved

Error 18452 and other problems

Posted on 2007-10-11
5
Medium Priority
?
337 Views
Last Modified: 2010-08-05
I am trying to connect from Linux to SQL Server 2005. I'm using the following line in my jsp program:
con = DriverManager.getConnection( dbURL2);

If my dbURL2 is:
jdbc:sqlserver://192.168.0.1:1433;DatabaseName=OSH2007;user=hprs/mark;password=12345;
Connection Failed. Status: 18452

If I change the server portion of the string to: "192.168.0.1/TRAVERSE105" I get:
Connection Failed. Status: 0
but it still throws the SQLException exception and my con is null. I do have the SQL Server authentication set to 'SQL Server and Windows Authenication Mode'

What's wrong?
0
Comment
Question by:jmarkfoley
5 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 20063355
try this

192.168.0.1\TRAVERSE105
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 20063382
try this,

String conURL = "jdbc:sqlserver://192.168.0.1:1433;database=OSH2007;"

and give the username and pwdin the getConnection method,

DriverManager.getConnection( conURL , "hprs/mark", "12345" );
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 20069068
aneeshattingal: that didn't work: 18452
ksivananth: I had tried that previously. That didn't work: 18452

I'm trying to use my own Windows login Id. Should I create a special Id just for this?

Also, this is a bit annoying, but slightly off topic: I am running this test program in my context directory unpacked on a Linux host. On this Windows Back Office server, it often doesn't refresh the browser from the modified jsp program. I get the same display and strings from previous versions of the program. I generally have to copy my .jsp to a new file name in order to run it. What's up with that? I've got the brower set to check for modified pages every time. This didn't happen when I browsed with my own XP workstation.
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 20069358
OK, I created a new SQL Server login that is specifically 'SQL Server Authentication'. Same 18452 problem. Connection String:
jdbc:sqlserver://server\TRAVERSE105:1433;DatabaseName=OSH2007;

When I changed the connection string to:
jdbc:sqlserver://server\TRAVERSE105

I got: "Cannot Open User Default Database (error 4064)" The MS KB lists causes:
" Is in suspect mode.
" No longer exists.
" Is in single user mode and the only available connection is already being used by someone else or by something else.
" Has been detached.
" Has been set to the RESTRICTED_USER state.
" Is offline.
" Is set to emergency status.
" Does not have the login account mapped to a user or the user has been denied
access.
" Is part of a database mirror.

The only possibility here appears to be "Does not have the login account mapped to a user or the user has been denied access." I'm winging the dba stuff. Does this info give anyone a clue? Maybe some of you SQL Server DBA types?
0
 
LVL 42

Accepted Solution

by:
dqmq earned 2000 total points
ID: 20071361
After creating a login, go to the User Mapping tab and indicate the database-user combinations that you want to give that login access to. It's an especially critical step to map a user to the default database.
 
Right click:  Security->Logins->YourLogin
Left click: Properties
Select: User Mapping  tab;  Check the box for YourDB.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question