sqlanywhere / node-sqlanywhere

SAP SQL Anywhere Database Client for Node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sybase 16 not supported

saquibkhan opened this issue · comments

Sybase 16 not supported

Can you be more specific about what problems you are seeing?

I have a sybase 16 db file. When i am trying to connect to it I ma getting error to upgrade sybase server

Logs:

conn.connect({
     ^
Error: Code: -934 Msg: Unable to start specified database: Server must be upgraded to start database Database.db
    at Error (native)
    at Object.<anonymous> (C:\SAQUIB\git\Test\index.js:6:6)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

That error message means that you are trying to run a database built with a newer version of SQL Anywhere than the server that is trying to start it. Do you have multiple versions of SQL Anywhere installed on your computer?

Yes today I installed Sybase 16, and now I have both sybase 16 and sybase 11 But i was getting this error even when i was having only sybase 11 installed.

You need to make sure that SQL Anywhere 16 is earlier in your path than SQL Anywhere 11 so that the node.js driver picks up the v16 version of dbcapi.dll. Then it will start the right version of the server. Alternatively, you could manually start the v16 server on the database and then run your node.js application, rather than having the application start the server.

ok, if i keep the server open then connection is successful but i am getting below error on basic query:

    if (err) throw err;
                   ^
Error: Code: -2001 Msg: Invalid Object
    at Error (native)
    at C:\SAQUIB\git\Test\index.js:25:8

Test Code: (Note: I use any other table I get same error)

var conn_params = {
  Server  : 'DB_SERVER',
  UserId  : 'xxxxxxx',
  Password: 'xxxxxxxx'
};


conn.connect(conn_params, function() {
    console.log("Connection successful");

  conn.exec("SELECT * FROM sysobjects", function (err, rows) {
    if (err) throw err;
    console.log('Rows: ', rows);
    conn.disconnect();
  });
});

I'm going to need the query, or preferably the whole index.js file. Feel free to remove passwords. If you'd rather not post it here, you can email it to me at graeme [dot] perrow [at] sap [dot] com.

Please find the file below:

var sqlanywhere = require('sqlanywhere');

var conn = sqlanywhere.createConnection();

var conn_params = {
  Server  : 'DB_SERVER',
  UserId  : 'xxx',
  Password: 'xxx'
};


conn.connect(conn_params, function() {
  console.log("Connection successful");

  conn.exec("SELECT * FROM sysobjects", function (err, rows) {
    if (err) throw err;
    console.log('Rows: ', rows);
    conn.disconnect();
  });
});

I removed my previous comment since I missed the error in your script. The callback function you supply for the connect call should take an error parameter, but it doesn't. If you change the connect call to this:

conn.connect(conn_params, function( err ) {
    if( err ) throw err;
    console.log("Connection successful");
    ...

You should see a connection error. Your connection parameters are probably incorrect, and the error message might give you enough information to fix it. If not, post the command you're using to start the database server.

Yes I am getting following error on connection:

        if (err) throw err;
                       ^
Error: Code: -95 Msg: Parse error: Invalid or missing keyword near 'Server'
    at Error (native)

Is SQL Anywhere 16 earlier in your path than SQL Anywhere 11? The Server connection parameter was added in SQL Anywhere 12, so the v16 driver should recognize it while the v11 driver would not.

Thanks it worked.

commented

Hello I am facing semiler issue on my live server. I was publish my Asp.net MVC 4.0 project on server and installed Sql Anywhere 16 developer version. and create ODBC 64 database objects. and it was running smooth. but before 2-3 days i was installed Sql Anywhere 12 licence copy on server for another use. Now my site is not connecting database. It says "System.Data.EntityException: The underlying provider failed on Open. ---> iAnywhere.Data.SQLAnywhere.SAException: Unable to start database server
at iAnywhere.Data.SQLAnywhere.SAConnection.Open()"

Error. Please help to solve this error. I am beginner of SQL Anywhere.

Thanks.

Did you try the same solution? Is SQL Anywhere 12 earlier in your path than SQL Anywhere 16?

commented

Actually i read above all comment but i didnt get that where i can set or configure that my Sql Anywhere 16 run first. I am calling multiple database in single solution. So all database will call dynamic through application. Please give me steps or detail guideline.

Like I said, set your path so that the SQL Anywhere 16 software is earlier than the SQL Anywhere 12 software. Or you can remove the SQL Anywhere 12 directories from your path entirely since it's unlikely you'll need both.

commented

Thanks for the reply but i still didnt understand that where i can find path? because my connection string is likely,

metadata=res:///DB.csdl|res:///DB.ssdl|res://*/DB.msl;provider=iAnywhere.Data.SQLAnywhere;provider
//connection string="UserID=DBAq;Password=SQLq;DataSourceName=Testq"" providerName="System.Data.EntityClient"

and i setup ODBC using below steps,

Step 1) Open ODBC Data Source Administrator (64 bit) from All application.

Step 2) Click on to tab System DNS.

Step 3) Click Add button and select SQL Anywhere 16 and click finish.

Step 4) Now on ODBC Configuration for SQL Anywhere window, click to Login Window.

Step 5) Enter User ID of your database on User Id field.
Step 6) Enter Password of your database.
Step 7) On Action Tab select - "Start and connect to a database on this computer" option.
Step 8) Browse database .db file from location.
Step 9) Click Ok. button.
Step 10) click on ODBC tab -> and enter Data Source Name for your reference and click on "Test Connection" button.

Step 11) if connection establish then click ok.
Step 12) Repeat step 2 -11, to add another database.

I'm talking about the Windows system path. The way to change it is slightly different depending on the version of Windows you are running. For Windows 8, find My Computer on your desktop or under the Start menu, right-click on it, and select Properties. Then click Advanced system settings, then Environment variables. Under "System variables", there should be an entry for PATH. You need to edit that value and make sure that your SQL Anywhere 16 bin64 directory is ahead of the SQL Anywhere 12 bin64 directory, or just remove SQL Anywhere 12 bin64.

commented

Thanks for quick reply. I really get frustrated due to this error. I remove SQL Anywhere 12 from System variables but still error is remain. Unable to start database server. If you have another solution please help.

Sorry, I should have mentioned that if you change the system variables, you need to reboot the system for the changes to take effect. That's a Windows limitation.

commented

I have restart the server and new error is generate. "The underlying provider failed on Open. ---> iAnywhere.Data.SQLAnywhere.SAException: Unable to start specified database: Server must be upgraded to start database C:\PDMS Database\MainDB\MainDB.db
at iAnywhere.Data.SQLAnywhere.SAConnection.Open()"

It looks like it is trying to start the SQL Anywhere 12 server but the database was created or upgraded with SQL Anywhere 16. However given the connection string above, you're not using the node.js driver anyway. That looks like an ASP.NET thing, which I know nothing about.

You may want to post your question on http://sqlanywhere-forum.sap.com/ and someone can help you.