Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem reading SQL Server from java

Status
Not open for further replies.

wduty

Programmer
Jun 24, 2000
271
US
I am trying to query a simple test database in SQL Server from java/JDBC. However, when I attempt to read tables I created I get an "Invalid Object Name" exception. When I get the a DatabaseMetaData.getTables resultset I get only the system tables but not user tables. Thus it seems that JDBC is connecting but not giving me full access somehow.

Does anyone know why this would happen? This is the case not only with my test database but also with the Northwind (demo database) that comes with SQL Server.

The weird thing is that I can read user tables fine through asp/ADO but not java/JDBC.

Any help, comments, or suggestions greatly appreciated.

--Will Duty
wduty@radicalfringe.com

 
I'm not a JDBC user, but it sounds like the default database for the username you are using to sign in with is not your test database.

Either set your test database as the default for that username, or (if you can in JDBC) explicitly change databases when establishing a connection.

Robert Bradley

 
Robert,

Precisely...

I wish I had posted earlier because your observation would have saved me a lot of wasted time going around in circles only to find I just had to change a drop-down option in the ODBC setup. Works now.

Thanks!

--Will Duty
wduty@radicalfringe.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top