For newbies: creating a new empty SQL Anywhere database

In case you ever need to create a new SQL Anywhere database, there are three ways you can accomplish this. These methods apply to the Developer Editions of both SQL Anywhere 9 and 10 (not the copy that comes with Servoy).

1. Use the dbinit command-line utility.

Open a Terminal and source one of the following files (depending on your version of SA):

/Applications/SQLAnywhere9/System/bin32/asa_config.sh

/Applications/SQLAnywhere10/System/bin32/sa_config.sh

Change to the directory where you want to create the database and issue this command:

dbinit mynewdb.db

This will create a new empty database mynewdb.db. You can then start it using the DBLauncher icon or by issuing one of these two commands:

For version 9: dbeng9 mynewdb.db

For version 10: dbeng10 mynewdb.db

Now your db will be running and you’ll be able to connect using the default user id and password (dba/sql).

2. Use Sybase Central

Start Sybase Central (use the desktop icon) and do not connect to any database. From the Tools menu, select (for SA9) Adaptive Server Anywhere → Create Database; or (for SA10) SQL Anywhere 10 → Create Database.

This opens up a wizard to create the db - just follow the instructions. By default, you will be automatically connected to the db after it is created when the wizard completes.

3. Use SQL statements

Use the following statement inside Interactive SQL (start from desktop icon):

CREATE DATABASE ‘/home/myuser/mynewdb.db’

You must be connected to another database before you can execute this statement.

Once you’ve created the db, you can add it to the Servoy configuration.

That’s it! I hope this is helpful to someone.

Regards,

Jose Ramos
Product Manager
Sybase iAnywhere

Thanks Jose. I’ve also done a very brief overview of Sybase Central on our Tutorials page. It can be viewed at: http://www.servoy.com/downloads/tutoria … ntral.html

I am almost going nuts. I have been trying for over an hour to create one silly empty database using Sybase Central 10.

If I “just follow the instructions” I end up with an error, stating that the database could not be created. No details, no log, no nothing. The command line tool gives the same error.

We do this on a “clean” Windows XP machine, Servoy 3.5 clean install and Sybase Central 10, freshly downloaded from the web.

patrick:
If I “just follow the instructions” I end up with an error, stating that the database could not be created. No details, no log, no nothing. The command line tool gives the same error.

We do this on a “clean” Windows XP machine, Servoy 3.5 clean install and Sybase Central 10, freshly downloaded from the web.

Hello Patrick,

Under WinXP, there is no file to ‘source’ (unlike Mac OS X). What should happen is that your PATH environment variable should include (default) C:\Program Files\SQL Anywhere 10\win32. The database creation utility, dbinit.exe, is located in that directory.

Could you please post the error message that you are getting?

Thanks,
Jose

Hello Jose,

thanks for your help. It is really frustrating if such a simple task just fails without any traceable error message.

Windows path variable contains

C:\Programme\SQL Anywhere 10\Sybase Central 5.0.0\win32

Sorry, but the error is in German:

Angegebene Datenbank konnte nicht gestartet werden: Start der Datenbank … nicht moeglich Die Datenbankdatei … konnte nicht erstellt werden.

It says “Could not start database: start not possible” and “Could not create database”.

The database creation utility, dbinit.exe, is located in that directory.

This is not the case! Maybe thats the cause of the problem. We have installed Servoy with database. When we installed Sybase Central we did not install a DB server again, but just the tools. So dbinit is located in Servoy/sybase_db. But I even tried to create a DB using dbinit directly.

patrick:
This is not the case! Maybe thats the cause of the problem. We have installed Servoy with database. When we installed Sybase Central we did not install a DB server again, but just the tools. So dbinit is located in Servoy/sybase_db. But I even tried to create a DB using dbinit directly.

Thanks for this info. I installed SA10 separately from Servoy, which is why I have the utilities. Let me install just Servoy on a clean machine to find out what you need to do.

Jose

I am really getting a bit wild on this. I have tried to create the DB in a full install of SQL Anywhere 9. There I am getting an error that xy60.sql could not be found. I can see the file just fine in the scripts folder. Ok, I forgot that install and went back to my Sql Anywhere 10 machine. I have installed the whole bunch os stuff and finally managed to create an empty DB.

Now I want to test mobilink (this is what this is all about). I start to configure the mobilink settings, everything looks great. At the end I get an error that the script could not be generated: “error encountered”. Very helpful. So I am lost here. Then I choose iAnywhere online resources from the help menu of Sybase Central. The browser opens: Page cannot be displayed. No surprise, because the URL is http://support/ianywhere.html. Excellent. I wonder what happens next. All of this happens on a blank machine with everything installed from scratch.

All we actually want to do is to test mobilink replication for a postgres DB with 10 tables against a Sybase DB.

patrick:
All we actually want to do is to test mobilink replication for a postgres DB with 10 tables against a Sybase DB.

Patrick,

Unfortunately, although it is possible to use a PostgreSQL database as the consolidated, it is not supported by the MobiLink synchronization wizard. The reason is that the wizard will try to create a few system tables and stored procedures (it runs the SQL files located in the folder \MobiLink\setup). The SQL files in there are specific for the cons dbs we support (SA, ASE, MS, Oracle, DB2). You would have to run the SQL file against PostgreSQL and work on eliminating the errors.

There is another option. You can use MobiLink Direct Row Handling, a feature that will allow you to synchronize to PostgreSQL. Detailed information on how to do this is found in our docs. Here is the direct link:

http://www.ianywhere.com/developer/prod … based.html

Hopefully this is along the lines of what you’re trying to do. Sorry I couldn’t be of further help with PostgreSQL.

Regards,

Jose Ramos
Product Manager
Sybase iAnywhere

Jose,

thanks for helping out. It would be a great improvement if the error could simply state just that.

I will check the documentation.

Thanks
Patrick

And: if I understand you right, I could set everything up say against MS SQL and then take the script and see how it does in PostgreSQL?

patrick:
And: if I understand you right, I could set everything up say against MS SQL and then take the script and see how it does in PostgreSQL?

I assume you mean running the setup script and they trying out the ML wizard again. The script should definitively work under MSSQL, but when you bring it to PostgreSQL, you’ll start seeing errors. For example, the very first ML system table created uses the type BINARY, which is not valid in PostgreSQL - so you would need to change that to a type that is compatible.

Then let’s say that we have a script that PostgreSQL understands. Unfortunately we cannot guarantee that the ML wizard will work to completion :-( (since we only test the supported consolidated databases).

Thanks,
Jose

jramos:
For example, the very first ML system table created uses the type BINARY, which is not valid in PostgreSQL - so you would need to change that to a type that is compatible.

In PostgreSQL you use type BYTEA for binary data.

Hope this helps.