Can't connect to SQL Anywhere db with a - character in name

Other Databases - related issues
Post Reply
aschild
Posts: 20
Joined: Fri Apr 19, 2013 12:06 pm

Can't connect to SQL Anywhere db with a - character in name

Post by aschild » Tue Apr 23, 2013 10:02 am

When I try to connect to a sql anywhere 11 database which has a dash in the name of the database, I receive a error.

The connection string is: jdbc:sybase:Tds:myserver:2638?ServiceName=client-db1
If I try to connect to a database on the same server without a dash in the dbname, it works correctly.

11:58:09 Test Connection Failed <html><h3>Database or Network Error</h3>com&#046;sybase&#046;jdbc3&#046;jdbc&#046;SybSQLException&#058; SQL Anywhere Error &#045;131&#058; Syntax error near '&#045;' on line 1<br>

com.sybase.jdbc3.jdbc.SybSQLException: SQL Anywhere Error -131: Syntax error near '-' on line 1
at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.queryLoop(Unknown Source)
at com.sybase.jdbc3.jdbc.SybCallableStatement.executeQuery(Unknown Source)
at com.sybase.jdbc3.jdbc.SybDatabaseMetaData.if(Unknown Source)
at com.sybase.jdbc3.jdbc.SybDatabaseMetaData.getSchemas(Unknown Source)
at com.wisecoders.dbs.rdbms.d.a(SourceFile:145)
at com.wisecoders.dbs.layout.ui.editors.v.a(SourceFile:40)
at com.wisecoders.dbs.layout.ui.editors.v.doInBackground(SourceFile:16)
...



DbSchema version 6.3.0 build 3783 Java 1.6.0_39

aschild
Posts: 20
Joined: Fri Apr 19, 2013 12:06 pm

Re: Can't connect to SQL Anywhere db with a - character in n

Post by aschild » Wed Apr 24, 2013 7:48 am

Here what the server logs in as sql statements:

The dbname: client-project

+4,<,17,EXEC_ANY_IMM,dbo.sp_jdbc_getschemas
=,[,17,sp_jdbc_getschemas,6,set @sp_owner = '%'
=,],17,sp_jdbc_getschemas,6
=,[,17,sp_jdbc_getschemas,8,set @sp_qualifier = db_name()
=,],17,sp_jdbc_getschemas,8
=,[,17,sp_jdbc_getschemas,9,execute immediate 'select TABLE_SCHEM=name, TABLE_CATALOG='''+@sp_qualifier+''' from ' +@sp_qualifier+'..sysusers where ' +' name like '''+@sp_owner +''' order by name'
=,],17,sp_jdbc_getschemas,9
=,E,17,-131,Syntaxfehler bei '-' in Zeile 1
=,>.,17

donose.mihai
Posts: 470
Joined: Thu Apr 07, 2011 11:05 am

Re: Can't connect to SQL Anywhere db with a - character in n

Post by donose.mihai » Thu Apr 25, 2013 7:00 am

I'm not sure if it comes from DbSchema or it comes from the JDBC driver, i've opened a ticket for our developers so they can check it out, issue ID: 0001546

peleus
Posts: 54
Joined: Fri Nov 09, 2012 3:43 pm

Re: Can't connect to SQL Anywhere db with a - character in n

Post by peleus » Sat May 11, 2013 2:37 pm

Hi aschild, I'm just wondering, how were you able to get around this. Was there a work around instead?

aschild
Posts: 20
Joined: Fri Apr 19, 2013 12:06 pm

Re: Can't connect to SQL Anywhere db with a - character in n

Post by aschild » Mon May 13, 2013 6:06 am

peleus wrote:Hi aschild, I'm just wondering, how were you able to get around this. Was there a work around instead?
The workaround is to rename the database to not contain a - in the name....

Stellaban
Posts: 1
Joined: Wed Mar 21, 2018 7:58 am

Re: Can't connect to SQL Anywhere db with a - character in name

Post by Stellaban » Wed Mar 21, 2018 12:11 pm

The cause of this page is to expose how to debug viable connectivity problems to sq. anywhere database. not unusual Connectivity issues. Invalid connection strings (e.g. missing HOST, lacking PORT )because you need to inform the database server who you're (and if you're the usage of incorporated login you don't even need the ones, however, it truly is beyond the scope of this query).

Post Reply