table or view doesn't exist

Hello I am trying to run a select statement in Java against SQL Server 2K. But I keep getting an error saying that the table doesn't exist.

Is this a problem with my SQL statement

select * from counting

I also tried

select * from dbo.counting

my connection url is

jdbc:microsoft:sqlserver://IS-0081526:1433;databaseName=bail;

I can run these queries from Query analyzer I am able to run them with the same account and login.



Answer this question

table or view doesn't exist

  • R-man

    are your java connectivity softwares properly installed



  • bbanks

    I used the SQL Profiler and I didn't even see the transaction reach the database.

    I am using jdeveloper and the datasource I created can retreive data from the server, through its data viewer tool. Could it be that my sql stamtement is being stoped by the driver before it reaches the database

    I have tried using java.sql.preparedstatements along with spring.dao MappingQuery. Is there a function in the sql server 2k driver that will compile sql statements


  • Grouchypb

    I found out the problem :-)

    The sql server won't take PreparedStatements, so I used a CreateStatement and now I can access the table.

    Thanks for all the help.


  • Developer1

    Tough to say.

    You are not doing anything fundamentally wrong.

    My guess is that your connection string is not correct or it is not picking up the specified DatabaseName (do you have the capitalization right on that attribute

    One thing to try is to run SQL Profiler. This is a tool that allows you to watch the commands that are running on your database. If you run this while running your app and while running the query in query analyzer. My guess is that you will see either nothing from the first or a different database.



  • table or view doesn't exist