Wednesday, September 27, 2006

Sybase SQL Anywhere joys

To connect to the f**king stupid Sybase SQL Anywhere (vers 5.5 and down) from a Java app on Windows NT/XP, you'll need, aside from the stupid SQL Anywhere server, another stupid piece of garbage named Open Server Gateway which enables remote client connections to a SQL Anywhere instance.

So what you have to do is:

1.) When installing SQL Anywhere Server make sure you find and check the checkbox that says
'Install the Open Gateway Components' or such shit

2.) Start a SQL Anywhere db engine like this:

dbsrv50.exe c:/sqlany50/sademo.db -n demo

This basically says start the DB from that file, and name it demo

3.) Go to C:\sybase\bin folder or wherever the installation put that stupid folder and start sqledit.exe

In there you'll need to define an Open Gateway instance as follows:

3.1) Into 'Input Server Name' put the name of the OGS instance like 'remote'
3.2) Choose Service Type = 'master'
3.3) Choose Platform = NT
3.4) Choose Net Library driver NLWNSCK
3.5) Connection information/network address - put here the IP the Open gateway will run on and the port, comma separated, like this:
192.168.4.5,5555 - intuitive huh ? Stupid schmucks !
3.6) Click on add service
3.7) Go to File - > Save and exit the DAMN ANTIC tool !

4.) Start the dbos50.exe with a command line like this:

dbos50.exe -e demo remote

Which means: start a damn Open Server Gateway instance named 'remote', use as the SQL Server Engine (-e demo) the one you find with the name 'demo'

Basically what you need to get right is to pass in the OGS name you've configured with sqlqedit (in this case 'remote')

After this, you'll be able to use JConnect from java to access this database as with any DB using JDBC follows:

private static final String USR = "dba";

private static final String PASS = "sql";

private static final String HOST = "192.168.4.55";

private static final String URL = "jdbc:sybase:Tds:" + HOST + ":5555";

.........

5.) If you agree with me that this is all completely BULLSHIT, pursue everybody to DUMP this shit and use PostgreSQL or the free version from Oracle or whatever else instead of this abysmal piece of shit and garbage named SQL Anywhere Server or Open Gateway Server or whatever else.

I've spent 2 days of my developer life to search the net for this information, including those useless Sybase resources, when for any other DB all you need to do is hit the fucking install.exe, grab a JDBC driver and connect to the freacking default DB that is there no doubt.

Some people never learn.

3 comments:

Anonymous said...

thanks for the info!

We will stay away of Sybase from now on.

The Rabbit said...

Well, at least stay away from ANY old Sybase installment (meaning 5.5 down, if I read correctly on their sites, you don't need to do all that stuff for the newest versions) but guess what: that won't help you alot because one day you'll get a customer who'll say: "well, we need to also read some data from a legacy app we have since some time now, it's developed long time ago, it works on Sybase SQL Anywhere 5.0" etc. That's when your luck is over! :-D. But you can come back anytime and see how to get through it :-)

Breck Carter said...

Next time, save two days of effort and ask for help on the newsgroups... there are quite a few people there who remember how to use VERY OLD versions like 5.5 :)