• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 :
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
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 :
java.sql.SQLException:
[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 ?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic