This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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: 20078

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
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Problem in fetching data from sql server 2005
It's not a secret anymore!