Just been playing with node.js and trying to get it to connect to an SQLAnywhere database. The servers we have are a mix of 8.02 and 10. I know that the former is not supported, but PHP and v12 clients seem to have no trouble connecting.
The thing that baffles me is that the connection parameters used in examples seem strangely incomplete. Traditionally, I've always had to specify IP address, DB Server name, DB Name, UserID and Password. Most of the examples seem to suggest that server name and db name are not necessary. In which case, how does the code decide which database to connect to when a server is hosting several?!!!
I tried both: - unixodbc and FreeTDS (I got stuck with a "Can't find the specified Database" once I'd got the server coordinates correct) - sqlanywhere node module (I don't even know where to get any diagnostics - the code simply doesn't work!)
I wonder if anyone else has been here before!
asked 31 Oct '14, 18:26
Does this mean you have figured this out or are you still stuck?
FreeTDS is not an SAP (nor a Sybase) feature and it will not Sybase-style TDS in all cases. You might want to try to see if switching to the PHP driver supplied with SQL Anywhere helps you out more.
I doubt that DBN will be respected if you continue to use FreeTDS. The concept required to map to the SQL Anywhere DBN, is that of "ServiceName" as it exists in JConnect or OpenClient, but you are using neither so (this not be available to you. Note this and dbn are also different from "Database=<database>" connection parameter in the FreeTDS ODBC implementation since that will map to a "USE <database>" statement that will just be ignored by SQL Anywhere so that approach is not an option either.
I recommend using either the SQL Anywhere PHP driver or to switch over to using ODBC and the native SQL Anywhere ODBC driver.
answered 04 Nov '14, 13:28
Nick Elson S...
Re: Most of the examples seem to suggest that server name and db name are not necessary. In which case, how does the code decide which database to connect to when a server is hosting several?!!!
Defaults, defaults, defaults... For example, the port default is 2638, the database default is first database started, and so on.
So if there is any chance that you might not connect to the right server/database, then use connection parameters to get it right. But Port is not allowed in the hash. Use ip-addr:port in Host. For example (pardon the formatting):
answered 06 Nov '14, 12:09