0

I'm very confused about this situation. I'm developing a Spring Web Based App, I'm trying to implement a simple SQL Query but for some reasons there is a consistency problem. When I Run in Sybase Central: SELECT COUNT(*) FROM "DBA"."USUARIOS" I got 68 rows, but When I run the same query from my java program I got 21 rows.

I don't know if it's a driver problem, I'm very confused.

My Configuration:

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
              <property name="driverClassName" value="${jdbc.driverClassName}"/>
              <property name="url" value="${jdbc.url}"/>
              <property name="username" value="${jdbc.username}"/>
              <property name="password" value="${jdbc.password}"/>
          </bean>

          <context:property-placeholder location="classpath:jdbc.properties" />

          <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
              <constructor-arg ref="dataSource"/>
          </bean>

          <bean id="productoDAO" class="com.grupolainmaculada.siscom.persistencia.JdbcProductoDAO">
              <property name="jdbcTemplate" ref="jdbcTemplate"/>
          </bean>

Properties File:

jdbc.driverClassName=com.sybase.jdbc4.jdbc.SybConnection
jdbc.url=jdbc:sybase:Tds:192.168.2.177:2638/bdSiSAC02
jdbc.password=wap
jdbc.username=dba 

I'm using jdk 7 and jconnect 7.0

Best Regards,

UPDATE Whe I run the next code:

System.out.println(connection.getCatalog());

The connection is pointing to other database, this is very rare for me I don't understand why is not pointing to my database if this is defined well.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
GeralDo
  • 114
  • 2
  • 6
  • 1
    I'm not familiar with Sybase, but I think you answered your own question: it sounds like your are connecting to two different schemas. Are you logging into sybase central with the same username and password (dba/wap) and to the same host/port/db? – Glenn Mar 06 '12 at 21:54
  • It's rare, because jdbc.url is pointing to bdSiSAC02 but when I run getCatalog() it says I'm connected to bdIshishimi. Very Rare Problem, I'm loggin into sybase central with the same usernam, password , host/port/db and everything is fine. – GeralDo Mar 06 '12 at 22:05
  • I found the problem, it was my mistake the port it was not the default 2638, I changed this param and now I'm connected to the database. I don't know if it's correct but I think It should give me an error, and don't redirect me to a other database instance. – GeralDo Mar 06 '12 at 23:50

0 Answers0