Announcement Announcement Module
Collapse
No announcement yet.
exception while executing select statement Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • exception while executing select statement

    Hi

    I created the following table in Sybase

    create table dept(dno numeric(8,0),dname varchar(20))

    Inserted 3 records.

    ------------------------
    In java

    DriverManagerDataSource ds = new DriverManagerDataSource();
    ds.setUrl("jdbc:sybase:Tds:hostnameortno");
    ds.setUsername("iris_dbo");
    ds.setPassword("london12");
    JdbcTemplate jt;
    jt = new JdbcTemplate(ds);
    jt.queryForInt("select count(*) from dept");


    Exception:
    org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [null] in task 'executing StatementCallback'; nested exception is com.sybase.jdbc2.jdbc.SybSQLException: dept not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
    at rg.springframework.jdbc.support.SQLStateSQLExcepti onTranslator.translate(SQLStateSQLExceptionTransla tor.java:79)
    at org.springframework.jdbc.support.SQLErrorCodeSQLEx ceptionTranslator.translate(SQLErrorCodeSQLExcepti onTranslator.java:163)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:185)
    at org.springframework.jdbc.core.JdbcTemplate.query(J dbcTemplate.java:216)
    at org.springframework.jdbc.core.JdbcTemplate.queryFo rObject(JdbcTemplate.java:243)
    at org.springframework.jdbc.core.JdbcTemplate.queryFo rInt(JdbcTemplate.java:252)
    at src.SpTest.execute(SpTest.java:61)
    at src.SpTest.main(SpTest.java:30)
    Exception in thread "main"


    Thanks
    Benno

  • #2
    benno,

    I guess that you come from Oracle

    dept not found. Specify owner.objectname or use sp_help
    sybase suggests here to prefix the object with the user name, for example scott.dept.

    HTH

    Comment

    Working...
    X