Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8076841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:20:56+00:00 2026-06-05T15:20:56+00:00

I successfully connected to my database when it was SQL Server 2008 R2. However

  • 0

I successfully connected to my database when it was SQL Server 2008 R2.
However after upgrading to SQL Server 2012, I get the following error in my java code
The application server that I am using is Tomcat7

The error is as follows:

Jun 10, 2012 1:56:10 PM org.apache.naming.NamingContext lookup
WARNING: Unexpected exception resolving reference
com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "MyDB" requested by the login. The login failed.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:197)
    at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:246)
    at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:83)

The connection string in context.xml is

<Resource name="jdbc/theDB" type="javax.sql.DataSource" auth="Container"
            factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
            driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" initialSize="30"
            maxActive="100"
        url="jdbc:sqlserver://localhost:1433;databaseName=MyDB;integratedSecurity=true"
            />

The following is in web.xml

<resource-ref>
<description>My Database</description>
<res-ref-name>jdbc/theDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

I can connect successfully to the database by opening a Data Connection in Eclipse, and in the fact the connection string that is generated is identical to the url from context.xml that I reproduce above.

Has anyone any ideas?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:20:58+00:00Added an answer on June 5, 2026 at 3:20 pm

    Make sure you the user that is running the application server has sufficient rights to the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to connect to a remote database (SQL Server 2008) through code using
I have connected with the database successfully by using wizard in server explorer. but
I have a piece of code that creates an SQL Server Express 2008 in
I am working on WPF application in C#. Database is SQL Server 2008. I
This is the following code: `package com.tom.jam; //import java.sql.Connection; //import java.sql.DriverManager; import java.sql.*; import
I am setting up Database mail in SQL Server 2008 to send mail to
I am trying to connect the sql server 2008 with servlet.this is my code.
I'm having trouble seeing tables from one particular SQL Server 2008 database while trying
I am trying to connect to an SQL Server 2012 database called Remisiones. What
I have successfully simulated an Oracle CONNECT BY statement in SQL Server 2008 by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.