Hello,
When I try to use the connect statement in Java like this:
| //connect to database | |||
| query = "CONNECT TO 'TOPADMINSA9' DATABASE 'ARCUS' USER 'dba' IDENTIFIED BY 'stef'"; | |||
| //query = "CONNECT TO '" + config.getDatabase() + "' DATABASE '" + databaseName + "' USER '" + config.getUser() + "' IDENTIFIED BY '" + config.getPassword() + "'"; | |||
| logger.info(query); | |||
| statement.executeQuery(query); |
I get this error:
16-07-14 10:47:52 [ERROR] TechLogger - -> com.sybase.jdbc3.jdbc.SybSQLException: ASA Error -131: Syntax error near 'CONNECT' on line 1
But when I execute the same command in my SQL Anywhere Interactive SQL the query works fine.
Any idea what I'm doing wrong?