I quickly tested this in SQL Anywhere v16.0.0 with this code and it is working without any issues. The table t is owned by dba;
String connectionString = "jdbc:sybase:Tds:localhost:2638?ServiceName=\"BANDENM&W\"";
System.out.println( connectionString );
Connection connection = DriverManager.getConnection(connectionString, "dba", "sql");
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("select * from t");
while( resultSet.next() ) {
System.out.println( resultSet.getInt(1) );
}
However, if I create an user "u" and change the getConnection to
Connection connection = DriverManager.getConnection(connectionString, "u", "sql");
The following is reported:
jdbc:sybase:Tds:localhost:2638?ServiceName="BANDENM&W"
Unexpected exception : com.sybase.jdbc3.jdbc.SybSQLException: SQL Anywhere Error -141: Tab
le 't' not found, sqlstate = 42W33
If I change the query to fully qualify the table (and assuming that the user "u" has permissions to query that table) as in:
ResultSet resultSet = statement.executeQuery("select * from dba.t");
the query completes without error.
I suspect that there are schema differences between the working and non-working database case and it is unlikely that the database name would result in the -141 error.