File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Problem in fetching data from sql server 2005 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Problem in fetching data from sql server 2005" Watch "Problem in fetching data from sql server 2005" New topic

Problem in fetching data from sql server 2005

Maheswaran Devaraj
Ranch Hand

Joined: Sep 14, 2007
Posts: 47
Hi all,

I have tried to fetch the values from my table named sample. It contains one field, it was named id. While I try to fetch the data It will throw exception. Name of my datasource is Sample.

my code is following:

The exception is:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'sample'.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source)
at db.ConnectUrl.main(

help me to resolve the problem.

Thanks and Regards,
Rob Spoor

Joined: Oct 27, 2005
Posts: 19905

You don't have a table called sample inside that datasource.

Moving to JDBC.

How To Ask Questions How To Answer Questions
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

...and why are you using the JDBC-ODBC bridge? You'll have fewer issues if you use a proper type 4 driver.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
It is sorta covered in the JavaRanch Style Guide.
subject: Problem in fetching data from sql server 2005