Error 18452 and other problems

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:
Connection Failed. Status: 18452

If I change the server portion of the string to: "" 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?
Who is Participating?
dqmqConnect With a Mentor Commented:
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.
Aneesh RetnakaranDatabase AdministratorCommented:
try this\TRAVERSE105
try this,

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

and give the username and pwdin the getConnection method,

DriverManager.getConnection( conURL , "hprs/mark", "12345" );
jmarkfoleyAuthor Commented:
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.
jmarkfoleyAuthor Commented:
OK, I created a new SQL Server login that is specifically 'SQL Server Authentication'. Same 18452 problem. Connection String:

When I changed the connection string to:

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
" 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?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.