Java / MSSQL: java.sql.SQLException Invalid object name 'TableName'

I am trying to move a Java application from the old server to the new server. The application runs on Tomcat, uses Microsoft SQL Server as the database, and uses the system DSN defined in Data Sources (ODBC) to decide what to connect to. The old server used Windows 2000 / SQL 2000, the new server uses Windows 2003 / SQL Server 2005.

The ODBC definition is identical between the servers and defines the database used.

On the new server, when the user tries to log in, the following appears in stdout.log:

user is checked Error: java.sql.SQLException: [Microsoft] [SQL Server ODBC driver] [SQL Server] Invalid object name "UserTable".

There is a table in the database called UserTable , but is displayed as dbo.USerTable through the management interface.

Is there any tweak in MSSQL that I have to tweak to make it happy with "dbo". is the prefix missing, or is there something else that I missed?

[edit] Windows authentication is used, and the Public and Guest roles are fully provided for DB as a troubleshooting step.

+4
source share
2 answers

Are different database logins? the dbo prefix is ​​just a schema in which the object is defined below. Therefore, if your ODBC connector uses dbo credentials to log in, this object should be in it by default.

+5
source

Do you need to use ODBC first? In my experience, SQL Server native drivers (type 4) are better. There is a Microsoft driver and jTDS . I don't have much experience with the MS driver, but jTDS is good.

Of course, if you are forced to use ODBC with other factors, this will not be useful to you, but if you have this option, it is worth a try. There would be a few more options in the Windows window.

+2
source

All Articles