facebook

I cannot connect to Sybase (DB Browser)

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #240195 Reply

    jcazenave
    Member

    I’ m not have problems with DB2, SQL Server and MySQL but when I try to connect my DB Browser to Sybase I received then next error: JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s). And I know that my user and password is OK because I don’t have poblems with a JAVA program or a Sybase tool.

    I’m using jconn3.jar (jConnect 6.0)

    I don´t have this problem if I used my program to connect to Sybase.

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import com.sybase.jdbcx.SybDriver;
    import org.apache.log4j.Logger;

    public class TestingSybase {

    private static boolean conectado;
    private static String url = “jdbc:sybase:Tds:ACCUSYS711MV2:5000/cobis”;
    private static String uid = “sa”;
    private static String pwd = “test”;

    public static void main(String[] args) {

    // Limpia los datos ingresados
    try{
    System.out.println(“Intenta conectarse contra Sybase”);
    sybaseConectar();
    if (conectado == true)
    System.out.println(“Se conecto a Sybase”);
    else
    System.out.println(“Se ha producido un error al intentar conectarse a Sybase.”);
    } catch (Exception e){
    System.out.println(“Se ha producido un error.\n”);
    e.printStackTrace();
    }
    }

    private static void sybaseConectar() throws ClassNotFoundException, SQLException, Exception{

    conectado = false;
    Logger log = Logger.getLogger(“Probando ejemplo de Sybase.”);
    log.info(“Creando una conexión contra Sybase de la base de datos COBIS.”);
    Connection connection;
    try{
    SybDriver sybDriver = (SybDriver)Class.forName(“com.sybase.jdbc3.jdbc.SybDriver”).newInstance();
    sybDriver.setVersion(com.sybase.jdbcx.SybDriver.VERSION_6);
    DriverManager.registerDriver(sybDriver);
    connection = DriverManager.getConnection(url, uid, pwd);
    conectado = true;
    } catch(ClassNotFoundException cnfe) {
    throw new RuntimeException(“ClassNotFoundException: ” + cnfe.getMessage() +
    “\nNo se pudo obtener una conexion contra la base de datos.”);
    }
    catch (Exception e){
    throw new RuntimeException(“ClassNotFoundException: ” + e.getMessage() +
    “\nNo se pudo obtener una conexion contra la base de datos.”);
    }
    log.info(“Creando una sentencia de ejecución de comandos a partir de una conexión Sybase.”);
    Statement stmt;
    try{
    log.info(“Crea una SENTENCIA a partir de la CONEXIÓN.”);

    stmt = connection.createStatement();
    // log.info(“BEGIN, inicia una Transacción (begin transaction).”);
    // connection.setAutoCommit(false);
    log.info(“Selecciona todas las tablas del tipo USUARIO con respecto a la base de datos COBIS.”);
    stmt.setCursorName(“objectsTU_cursor”);
    // A traves del objeto Statement(stmt) ejecuta la consulta(SQL) y retorna un objeto del tipo ResultSet
    ResultSet rs = stmt.executeQuery(“SELECT name FROM sysobjects WHERE type = ‘U’ order by name”);
    int i = 0;
    while(rs.next())
    {
    System.out.println(“Tabla: ” + rs.getString(“name”));
    i++;
    }
    rs.close();
    System.out.println(“\n\nTOTAL DE TABLAS DEL TIPO USUARIO: ” + i + “\n\n”);
    // log.info(“COMMIT de la Transacción (finaliza la trx).”);
    // connection.setAutoCommit(true);
    // connection.commit();
    log.info(“Cerrando el objeto SENTENCIA.”);
    stmt.close();
    log.info(“Cerrando el objeto CONEXION.”);

    } catch(SQLException sqle){
    throw new RuntimeException(“SQLException: ” + sqle.getMessage() +
    “\nNo se pudieron ejecutar los comandos para actualizar la base de datos.”);
    //if (connection != null){
    // try{
    // log.info(“Ejecuta ROOLBACK de la transacción.”);
    // connection.rollback();
    // } catch(SQLException sqle2) {
    // sqlError += “Error al ejecutar el ROOLBACK de la transacción: ” + sqle2.getMessage();
    // }
    //}
    //throw new RuntimeException(sqlError);
    }
    finally{
    if (! connection.isClosed()){
    if (! connection.getAutoCommit())
    connection.setAutoCommit(true);
    connection.close();
    }
    stmt = null;
    connection = null;
    }
    log = null;

    }

    }

    Thanks in advance.

    #240227 Reply

    Riyad Kalla
    Member

    You said there is an error displayed when trying to connect using the DB Browser, what is it exactly? Is there anything in your log file? (<workspace dir>\.metadata\.log)

    #240281 Reply

    jcazenave
    Member

    This is the error what I see in my <workspace dir>\.metadata\.log

    !ENTRY com.genuitec.eclipse.sqlexplorer 4 4 2005-10-27 16:59:52.548
    !MESSAGE Error while trying to login to database
    !STACK 0
    java.sql.SQLException: JZ00L: Fallo en la conexion. Examine los SQLWarnings vinculados a esta excepcion para conecer las causas.
    at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(ErrorMessage.java:572)
    at com.sybase.jdbc3.tds.Tds.processLoginAckToken(Tds.java:3911)
    at com.sybase.jdbc3.tds.Tds.doLogin(Tds.java:601)
    at com.sybase.jdbc3.tds.Tds.login(Tds.java:484)
    at com.sybase.jdbc3.jdbc.SybConnection.tryLogin(SybConnection.java:247)
    at com.sybase.jdbc3.jdbc.SybConnection.regularConnect(SybConnection.java:223)
    at com.sybase.jdbc3.jdbc.SybConnection.<init>(SybConnection.java:198)
    at com.sybase.jdbc3.jdbc.SybConnection.<init>(SybConnection.java:132)
    at com.sybase.jdbc3.jdbc.SybDriver.connect(SybDriver.java:179)
    at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:99)
    at com.genuitec.eclipse.sqlexplorer.actions.LoginProgress$Login.run(LoginProgress.java:43)
    at java.lang.Thread.run(Unknown Source)

    #240286 Reply

    Riyad Kalla
    Member

    Can you translate that please?

    #240326 Reply

    jcazenave
    Member

    The only phrase that I see in Spanish is: java.sql.SQLException: JZ00L: Fallo en la conexion. Examine los SQLWarnings vinculados a esta excepcion para conecer las causas.
    In english is this:
    java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s).
    —————
    I know that my user and password are correct, because if I used in my JAVA program or in a utility of Sybase I don’t have any problem to connect to Sybase.
    —————

    If you need something more or if you don’t understand something, please tell me. (I know that my english is not my best)

    Thanks.

    #240391 Reply

    krusson
    Member

    I’m having this exact same problem connecting to Sybase ASE. I’m able to connect with the same Driver and class using the dbVisualizer db tool.

    #240394 Reply

    Riyad Kalla
    Member

    We are looking into this, but we don’t have a demo sybase server setup right now.

    #240400 Reply

    Brian Fernandes
    Moderator

    Guys,

    Could you please try out the following:

    1) Make sure you’re using the production version of the driver. If you download the jConnect zip, you get jconn3.jar and jconn3d.jar – please use jconn3.jar.

    2) When setting up the driver in the Driver preference page, our tool automatically selects the first implemention of java.sql.Driver it finds. I notice that 4 implementations were listed in the Driver Class name combo, the last of which was com.sybase.jdbc3.jdbc.SybDriver. I believe this is the driver to be used, but com.sybase.jdbc3.jdbc.SybDataSource is selected instead (by default). Could you please make sure you select com.sybase.jdbc3.jdbc.SybDriver in the dialog before trying to connect to the database?

    3) I have seen reports of this error when there are too many users connected to the database or sometimes simultaneous access by the same user is disallowed. Could you make sure that this does not occur when you guys are trying to connect?

    Please let us know how it turns out,
    Best,
    Brian.

    #240519 Reply

    jcazenave
    Member

    I’m using
    1) jconn3
    2) com.sybase.jdbc3.jdbc.SybDriver
    3) I’m the only user who is working with this server, and I don’t have problems if I use “SQL Advantage -Sybase utilitie-” or my Java Program.

    In my Java Program, I detected a warning in the object connection. This warning was the LANGUAGE PROPERTY, so I added this property in my connection string and that’s all. I did the same in my DB Browser Connection but the problem continue (java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s).)

    #241114 Reply

    jcazenave
    Member

    The problem is the version of the jdk: “jdk1.5.0_01”. This version not support “CharSet cp850”.

    This version “jdk1.5.0_01”, solve the problem.

    Another jar that you can use in DB Browser to connect your Sybase is “jtds-1.1.jar” from http://jtds.sourceforge.net/

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: I cannot connect to Sybase (DB Browser)

You must be logged in to post in the forum log in