Results 1 to 2 of 2

Thread: exception while executing select statement

  1. #1
    Join Date
    Dec 2004
    Location
    India
    Posts
    9

    Default 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
    benno

  2. #2
    Join Date
    Aug 2004
    Location
    Montréal, Canada
    Posts
    845

    Default

    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
    Omar Irbouh

    Spring Modules Team
    http://irbouh.blogspot.com/

Similar Threads

  1. Replies: 37
    Last Post: Aug 10th, 2009, 03:35 PM
  2. Context initialization failed
    By kanonmicke in forum Container
    Replies: 7
    Last Post: Sep 29th, 2005, 12:35 AM
  3. hibernate pagination
    By oliverchua in forum Data
    Replies: 8
    Last Post: Sep 23rd, 2005, 06:06 PM
  4. Transaction Management
    By caverns in forum Data
    Replies: 3
    Last Post: Mar 8th, 2005, 06:38 AM
  5. Replies: 3
    Last Post: Nov 8th, 2004, 07:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •