Quantcast
Channel: SCN: Message List - SAP SQL Anywhere
Viewing all 2182 articles
Browse latest View live

Re: Can't get DECLARE statement to work

$
0
0

Hi Jeff and thanks for your response. And those are excellent questions...that I wish I could answer. 

 

This was not my script originally, and I can tell you that I know just enought about SQL to make my head hurt. But, I believe this is the Watcom SQL variety.

 

And I was mislead by the error dialog, the statement that was really causing the problem was the previous statement. I was trying to initialize the integer variable with value. So no it seems it's my "SET" statement that doesn't run. Here is the entire script in all it's glory.

 

BEGIN

DECLARE externalId int;

SET externalId = 500000;                                <====== This one not happy

DECLARE newItemName varchar(50);

DECLARE nextkey int;

DECLARE nextUofmKey int;

DECLARE nextXAKey int;

DECLARE gonext int;

SET gonext = 10;                                            <====== assuming this one also not happy

 

 

While externalId < 800000

    

    SET externalId = externalId + gonext

    -- make an item

    exec cbord.cbo_getnextkey  'cbo1000p_item', nextkey out

    SET newItemName = 'NewLinkedItem_' + CAST(externalId AS VARCHAR(10))

    INSERT INTO cbord.cbo1000p_item

               (Item_intid,UnitId,KeyName,LongName,ItemTypeCode,ActivityLevel

               ,ConstructedFlag,TLC,updatecount,creation_date,ItemGuid,Creator

               ,ItemRecipeLockFlag)

         VALUES

               (nextkey,0,externalId,newItemName,1,9,'N',GetDate(),1,GetDate(),NEWID(),1,'N')

   

    -- Make a uofm

    exec cbord.cbo_getnextkey  'cbo1020p_ItemUofM', nextUofmKey out   

    INSERT INTO cbord.cbo1020p_ItemUofM

        (ItemUofm_Intid,Item_intid,itemuofm_keyname,itemuofm_usage,ItemUofM_Qty,MeasureType,[Description],BasisRatio,TLC,unitid)

        VALUES

        (nextUofMKey,nextkey,'UofM_' + CAST(externalId AS VARCHAR(10)),'P', 1, 'B', 'unit', 1, GetDate(), 0)

       

    -- Make an ItemXA record

    exec cbord.cbo_getnextkey  'cbo1001p_itemxa', nextXAKey out

    INSERT INTO    cbord.cbo1001p_itemxa

        (Itemxa_intid,Item_intid,srv_ShortName,UnitId,srv_itemuofm_intid,Yield,default_itemxa_intid,TLC,Yield_itemuofm_intid,purtax1flag,purtax2flag,purtax3flag,purtax4flag)

    VALUES

        (nextXAKey,nextkey,'SN_' + CAST(externalId AS VARCHAR(10)),0,nextUofMKey,1,nextXAKey,GetDate(),nextUofMKey,'N','N','N','N')

    if (externalId >=600000 AND externalId < 700000) BEGIN SET gonext = 5 SET externalId = 700000 END

   

END

GO

 

Thanks for your help Jeff!

Tony


Re: Can't get DECLARE statement to work

$
0
0

Hi Tony,

 

I believe you're working with a Transact-SQL procedure. I can determine this because of these SQL constructs that appear in the code:

 

 

---

 

The "Could not execute statement. Syntax error near 'DECLARE' on line 4" error is the Watcom-SQL 'CREATE VARIABLE' issue that I had identified in the help - your DECLARE statements in Watcom SQL have to be grouped together at the start of the compound statement:

BEGIN

  DECLARE externalId int;

  DECLARE newItemName varchar(50);

  DECLARE nextkey int;

  DECLARE nextUofmKey int;

  DECLARE nextXAKey int;

  DECLARE gonext int;

  SET externalId = 500000;  -- Happy Watcom SQL parsing!

  SET gonext = 10;
  ...

 

For your issue, I'm going to assume that you do not want convert this script to Watcom SQL and would like to remain using Transact-SQL. If so, there are two rules you need to use here:

 

  1. Transact-SQL variables need to have "@" in front of their names
  2. Do not separate statements via semi-colons - this indicates to SQL Anywhere that you would like to use Watcom SQL instead

 

So, your variable section for Transact-SQL should look like:

 

BEGIN

  DECLARE @externalId int

  SET @externalId = 500000  -- Happy T-SQL parsing!
  DECLARE @newItemName varchar(50)

  DECLARE @nextkey int

  DECLARE @nextUofmKey int

  DECLARE @nextXAKey int

  DECLARE @gonext int

  SET @gonext = 10

  ...

 

Regards,

 

Jeff Albion

SAP Active Global Support

Re: Can't get DECLARE statement to work

$
0
0

Thanks for your help Jeff - that seems to have done the trick!

 

Tony

Seeing what a DB user is viewing, remotely using Sybase SQL Anywhere 16.

$
0
0

Does Sybase SQL Anywhere 16 provide any capability of remotely viewing all content related to an established user session in real time? 

 

I could use "SQL Anywhere Monitor" to do something like this, but I'd want to know what a particular user was looking at not, overall traffic.

 

Is there a way to use "Application Profiling" or "Application profiling wizard" remotely? Is there a way to get the actions of a particular user this way? Does this tool slow it down?

 

I think you can see the level of tracking I'd like to be able to use for this database, does anyone have any experience with this? Is it easier on other versions, or do I need to look a different program to run on top of SQL Anywhere 16?

 

Thanks,

 

Re: Seeing what a DB user is viewing, remotely using Sybase SQL Anywhere 16.

$
0
0

Application profiling allows you to log profiling data to a different server as part of the setup/configuration.

http://dcx.sybase.com/index.html#sa160/en/dbusage/perform-s-4379192.html

 

Application profiling does have a performance impact, anywhere from 5-25% depending on the options used when it is enabled.

 

If you want to, on an ad-hoc basis, see what is happening in a server, you can connect via DBISQL and procedures like sa_conn_info and sa_conn_activity to see what is happening

DocCommentXchange

http://dcx.sybase.com/index.html#sa160/en/dbreference/sa-conn-activity-system-procedure.html*d5e75330

 

If you turn on the RememberLastStatement option for the server ( "CALL sa_server_option('RememberLastStatement','ON');" ) you can also see the last statement executed by each connection. eg.

SELECT *, DB_NAME( DBNumber ),

  CONNECTION_PROPERTY( 'LastStatement', Number )

  FROM sa_conn_info( );

Re: Seeing what a DB user is viewing, remotely using Sybase SQL Anywhere 16.

$
0
0

Hi Gabriel,

but I'd want to know what a particular user was looking at not, overall traffic.


Is this to say you'd like to know which SQL is currently running for a connection in real-time? The best way to do this (graphically) is with the SQL Anywhere Console Utility (dbconsole).

 

---

 

Before you can see the SQL statements from connections on the server though, you first have to enable "Last Statement" tracking on the database server. This can be done in a few ways:

  • Add the -zl server option to the database server start line
  • Use the sa_server_option() stored procedure with the 'RememberLastStatement' property:

    CALL sa_server_option( 'RememberLastStatement', 'on' );
  • When connected with the SQL Anywhere Console Utility, change the setting directly in the options ( File> Options... ):
    dbconsole-rememberlaststatement.png

 

Once you have 'Remember Last Statement' enabled on the database server, new statements that arrive to the database server from connections will start to be tracked.

 

---

 

Once you're connected with the Console Utility, you can then add in the 'laststatement' column for connections to see these statements (File> Options...> Connection Viewer> 'laststatement' ):

 

dbconsole-rememberlaststatement-addcol.png

 

You can then see the active SQL statements in the console (updated as per the connection refresh settings as shown above):

 

dbconsole-conns.png

Regards,

 

Jeff Albion

SAP Active Global Support

Move datafile.db between v11 v16 ??

$
0
0

Can I take a v11.x .db file and open it with v16 on OS X, mass update some data (edit content of fields in existing records and add new records), then return the edited copy of the .db to the v11 server?  

 

Thanks,

Re: Move datafile.db between v11 v16 ??

$
0
0

Hi Dan,

 

Yes, this workflow is both possible and allowed. SQL Anywhere 16 can open SQL Anywhere 11 databases directly, without upgrading the format of the database file.

 

However, if you upgrade or rebuild the version 11 database file on version 16, then the database can then only be ever opened by the version 16 server afterwards.

 

Note that if you do use the version 11 database on a version 16 database server without upgrading or rebuilding, some version 12 and 16 new features may not be available.


Cheers,

 

Jeff Albion

SAP Active Global Support


Re: Move datafile.db between v11 v16 ??

$
0
0

Hi Jeff,

 

That's the answer I was hoping for! Thanks for the help.

 

Dan Ivy

4D Database Developer

www.4D.com

Support for Entity Framework 6

$
0
0

Hi,

 

when does the ADO.NET Managed Provider for SQL Anywhere 16 support the MS Entity Framework 6?

 

My knowledge is that only the MS Entity Framework 5 is supported at the Moment.

 

Many thanks

 

Robert

Re: Poor ADO.net Driver Performance

$
0
0

Hello,

 

Has there been any progress on the ADO.Net performance issue reported here?

 

I've done some testing and running a simple select statement on the server takes around 25ms. The same query running over a 15MBit connection takes around 500ms.

 

The query returns 29 rows. When the query is modified to return 0 results it still takes around 350ms. Locally this takes 15ms.

 

In another test, I return a 29 rows with a single integer - locally 12ms but over the internet 350ms.

 

I appreciate that it will take longer to return data over the internet vs local or even a local LAN but this difference is far larger than I would expect.

 

It looks like the internet request is taking 350ms with the full data payload being 150ms.

 

 

Thanks

 

Chris

Re: Poor ADO.net Driver Performance

$
0
0

For Internet scenarios the bandwidth is mostly not the bottleneck, but the latency is.

E.g. if you have a ping time of 50ms it means, that exchaning 10 messages to perform a task like a database query will lead to a minimum time of 500ms needed...

Re: Poor ADO.net Driver Performance

$
0
0

Hi Martin,

 

Ping time is around 38ms.

 

Performing a select that returns a single integer still takes between 330ms and 450ms.

 

I have a lot of experience with SQL Server and MySQL - I will put together a test to to compare the three databases.

 

Does a simple select statement really require 10 messages to be exchanged?

 

In the meantime, what connection string options could I use to improve network performance. I have been through the manual - none of the settings I tried make any significant difference (and I tried all the obvious ones).

 

Thanks

 

Chris

Problems with ODBC drivers in Windows 7 64-bit

$
0
0

When trying to execute a query through the ODBC driver upon initial connection the first query will be successful; however, the second query and any successive fail and return this error message:  [Sybase][ODBC DRIVER][SQL Anywhere]Invalid user Id or Password.

 

Computer specs:

SQL Anywhere version 11

Windows 7 64-bit

 

Does anyone know why this might be happening and if there is anyway to correct this problem?

Re: Poor ADO.net Driver Performance

$
0
0

Hi Chris,

 

>> Has there been any progress on the ADO.Net performance issue reported here?

 

Just to confirm, are we still referring to Ach's original ADO.NET .Fill() code with the same ADO.NET driver versions?


>> Does a simple select statement really require 10 messages to be exchanged?

 

The answer to his question is really: "it depends" -  the programming interface used, the preparation type of the statement, and the MTU size of your TCP network.

 

Have you been able to use WireShark or similar to trace out the two database client TCP conversations (WAN vs. LAN) to the database server in order to determine the difference in latency between the packets and if there are any errors associated with transmitting the packets over the WAN?

 

Also (and I'm not sure why ), we never actually asked about the SQL query being used - what is it and over what types of objects? What happens if you use a 'fake' query instead, does it change the behaviour? i.e.

 

  SELECT row_num FROM sa_rowgenerator( 1, 4000 );

 

Regards,

 

Jeff Albion

SAP Active Global Support


Re: Poor ADO.net Driver Performance

$
0
0

Hi Jeff,

 

Thank you for your reply.

 

I have to say I don't actually know the internals of how the data is being processed. For testing I've used both Entity Framework and NPoco (modified with a Sybase SQL Anywhere factory) converting the data into a strongly typed object. Perhaps I should have started a separate thread?

 

The simplest select statement I've been testing with is a parametrised query like this:

SELECT top 1 OrderID FROM DBA.Orders WHERE CustomerID=@0 order by OrderID

 

I have a saved a Wireshark capture - I'm happy to send this to you along with the demo application I have created, please let know where to send it.

 

To get a single integer from the database took 24 messages to the server and 22 from the server. Running on the local network the number of requests was the same but obviously it was much quicker as latency wasn't an issue.

 

I haven't got a proper test set up for MySQL at this stage but a similar request took 120ms to complete with 49 messages captured in Wireshark. The MySQL server is less powerful than the Sybase server but has a similar latency.

 

The actual query doesn't matter. I haven't seen a response from any query (even SELECT 1) take less than 316ms. If a lot of data is being returned it obviously takes longer which is to be expected.

 

If you let me know where to send the data and application I'll happily forward it on to you.

 

Chris

Re: Problems with ODBC drivers in Windows 7 64-bit

$
0
0

Hi Justin,

 

How exactly are you executing the query through the ODBC driver - is it a third-party program, or an ODBC application you wrote, or...?

 

Regards,

 

Jeff Albion

SAP Active Global Support

Re: Problems with ODBC drivers in Windows 7 64-bit

SQLAnywhere Sizing Guide.

$
0
0

Hi All,

 

Do we have sizing guide for SQLAnywhere ase we have for IQ and other databaes.?

Please let me know thanks

Sree

Bobj4.1 Sp2: CMS DB Sybase SQL Anywhere

$
0
0

Hi Experts,

 

Recently we have installed SAP Business Intelligence platform 4.1 SP2. Operating system is suse linux enterprise server 11 sp3 x86_64 and CMS DB is sybase sql anywhere. Installation was successful. After sometimes DB  went down. I am not able to log in to the CMC due to the CMS DB critical error.

when I am starting the DB using the dbeng12 option getting the following error.

 

dbeng12 -n BI4_CMS

/bobj/sqlanywhere/database/BI4_CMS.db


Resource temporarily unavailable

Database server shutdown due to startup error

Database server stopped at Sat Feb 22 2014 11:18

 

I already set the ulimit as per the installation guide. But it is still not working.

 

Thanks in advance.

Shemy

Viewing all 2182 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>