cancel
Showing results for 
Search instead for 
Did you mean: 

Java in the database

Former Member
0 Kudos
3,158

I have some questions regarding java in the database. From what I have read the efficiency of the java store procedures seem to have been deteriorated in SQL Anywhere 12, but I am wondering if I could use it anyway in SQL Anywhere 16. I am thinking of using java stored procedures in scheduled jobs in the database, so a scheduled job could "call" a java procedure...does anyone have any experience with this?

Then I wonder if it is possible for a java store procedure to call a ordinary procedure (watcom , t-sql procedure) in the database? Or can just a ordinary procedure call a java procedure?

Accepted Solutions (0)

Answers (1)

Answers (1)

MarkCulp
Participant

Regarding your comment on deteriorated performance of java store procedures (SP) in SQL Anywhere 12, I cannot comment on this except to say that I know of no change that would have made a difference to Java SP performance.

From within a Java SP you can call a SQL SP using normal JDBC calls back into the database. There is several topics on Java SPs in the documentation: for example, start by reading here and here and here.

HTH

VolkerBarth
Contributor
0 Kudos

Well, that FAQ deals with a rather simple Java stored function that has been called multiple times within one SQL statement where the cost of an in-process call (as of v9 and below) is apparently cheaper than a call of a JVM in a separate process (one per database server, as of v10 and above).

If you do not call your stored procedure very frequently, or if it does a not-so-cheap task itself, I guess you won't notice any performance penalty.

MarkCulp
Participant
0 Kudos

Yes, as Volker has pointed out (and also Glenn in his answer to that question), the in-process Java SPs was removed in v10 and changed to be an external process. Clearly the cost of doing a out-of-process call is more expensive than an in-process call so if you are doing lots of calls (relative to the amount of actual computation) then you will see an overall performance difference.

You need to consider your situation and weigh the costs and benefits between using Java SPs vs SQL SPs.

Former Member
0 Kudos

Thanks for your replies