Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-04-26 : 09:32:07
|
Melinda writes "When I run my query in the query analyzer I have no problems extracting my data. However, when I use the Microsoft 2000 Sql Server JDBC Driver to run the same query I get the following error:java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'INVPO_POI_NXTACT'This table is in my database and accessible. Here is my query:private static final String sql = "SELECT DISTINCT P.ENTITYCODE, " + "P.REQNNUM," + "P.CHRGTODEPTCODE," + "P.QTYORDRD," + "P.PURUNITOFMEAS," + "P.UNITPRICE," + "P.CREATEDATE " + "FROM INVPO.INVPO_POI P, INVPO.INVPO_POI_NXTACT N " + "WHERE P.PKEY = N.FKEY " + "AND P.ENTITYCODE = '?' " + "AND N.NXTACT = '?' " + "AND P.REQNTYPECODE = 'NSTK' " + "AND P.RECRDSTATUSCODE = '" + RequisitionDAO.STATUS_ACTIVE + "' " + "ORDER BY P.CREATEDATE ASC";Any help would be appreciated. I do NOT know what invalid object it is eluding to. It seems that the naming convention is acceptable because it runs in sql analyzer but I guess the Microsoft driver does not like it for some reason. THanks." |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-04-26 : 09:46:40
|
Make sure the object INVPO_POI_NXTACT exists in the databaseMadhivananFailing to plan is Planning to fail |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2006-05-02 : 21:38:17
|
for ease of reading and typing, you may want to remove those excess quotes... something like this...sql="select....from...where field1='" & yourValueHere & "' and field2....order by..."make sure to print out or show sql string so that you'll know you're generating the correct string for your dsql, but you should start creating sprocs, they're much easier to debug --------------------keeping it simple... |
|
|
|
|
|