The moose likes JDBC and the fly likes [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name" Watch "[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name" New topic

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name

Barry Kimelman

Joined: Nov 10, 2002
Posts: 1
I have a MS Sqlserver 2000 database installed on my Windows NT4 PC.
I want to access the database from a java program using JDBC - ODBC.
Note : a datasource name of "NORTHDS" was given during setup of sqlserver2000.
Here are the relevant lines from my java source code :
datasource = "NORTHDS";
database = "Northwind";
url = "jdbc dbc:" + datasource;
con = DriverManager.getConnection(url,username,password);
Statement stmt = con.createStatement();
query = "SELECT * from " + datasource + "." + username + "." + tablename;
ResultSet rs = stmt.executeQuery(query);
I am successfully able to create a connection and create a statement, but the
execution of the query fails with the error message :
[Microsoft][ODBC SQL Server Driver][SQL Server]
Invalid object name 'NORTHDS.Admin.Customers'.
Note : I am attempting to access the "Northwind Traders" sample database
that came with the installation of the sqlserver2000 database.
I have used the program "Microsoft Access" to verify that the database
table "Customers" (which is owned by "Admin") is intact and has records.
Any ideas/suggestions on how I can solve this problem ?
I agree. Here's the link: http://aspose.com/file-tools
subject: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
Similar Threads
using netbeans database wizard to connect to msaccess northwind database
configure an ODBC datasource----help
Invalid Descriptor Index
How to make a data source connection without writing a User name & Password and the -ds.xml file
exception while connecting sqlserver 2000 with java application