Results 1 to 3 of 3

Thread: Sybase error

  1. #1
    Join Date
    Nov 2012
    Posts
    2

    Sybase error

    We have a web application which uses Sybase as DB. Recently we found one error in the tomcat logs, which is printed in lacs of lines. The error was,

    -ERROR- JDBCDatabase.get: Attempt to access a database connection that has not been made. JDBCDatabase.login must first be called to get a connection.
    -ERROR- JDBCDatabase.getObjectField: No fields can be returned from this method because no query results exist to be retrieved. A query must first be executed through this class and then the get method must be called to reference a row of the query results before this method can be called.

    Could you plz let me know why this error is getting generated?

  2. #2
    Join Date
    Jan 2004
    Location
    The Hague/Utrecht, NL
    Posts
    517
    According to the first line there is no connection with the database. You cannot acces a database when you have no connection.
    Check your code if all the necessary commands are given. Connect, login, open db, etcetera.
    I'm not crazy, I'm an aeroplane!

  3. #3
    Join Date
    Oct 2012
    Posts
    8

    Cool

    You can open connection java to ASE using jConnect Driver as below :
    After that Run your code.

    If you need help regarding jconnect configuration , please check Jconnect Config Link :


    [sybase@localhost ~]$ cat JdbcTest.java
    import java.sql.* ;
    public class JdbcTest
    {
    public static void main( String args[] )
    {
    try
    {
    Class.forName( “com.sybase.jdbc3.jdbc.SybDriver” ) ;
    Connection conn = DriverManager.getConnection( “jdbc:sybase:Tds:localhost.localdomain:5000″, “sa”, “”) ;
    Statement stmt = conn.createStatement() ;
    ResultSet rs = stmt.executeQuery( “SELECT * FROM master..sysdatabases” ) ;
    while( rs.next() )
    System.out.println( rs.getString(1) ) ;
    rs.close() ;
    stmt.close() ;
    conn.close() ;
    }
    catch( Exception e )
    { System.out.println( e ) ; }
    }
    }

Posting Permissions

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