wood burning stoves*
The moose likes JDBC 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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem in fetching data from sql server 2005" Watch "Problem in fetching data from sql server 2005" New topic
Author

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(ConnectUrl.java:18)


help me to resolve the problem.

Thanks and Regards,
Mahes
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

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

Moving to JDBC.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Paul Sturrock
Bartender

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
 
Similar Threads
SQL Server 2000 Database Connection using JDBC
SQL Server 2000 JDBC Driver Error
No suitable driver found for JDBC
error when i run the program
MS Sql server2000 connection problem