2

I created a function in PowerBuilder.NET Hello World. The project compiled as Helloworld.dll, generated in C# from the PowerBuilder utility. Inside Helloworld, I made the non-visual n_cst_helloworld. Inside the non-visual, I made the object function of_hello(). These are the issues I encountered when trying to access Helloworld.n_cst_helloworld.of_hello() in an external function on SQL Anywhere.

The external function uses CLR and is called in Interactive SQL right now.

Here is the script I'm trying to launch in iSQL (through ASA):

ALTER PROCEDURE  "DBA"."ext_helloworld"()

EXTERNAL NAME

'helloworld.dll::Helloworld.n_cst_helloworld.of_hello( )' 

LANGUAGE CLR

Then, I use the following in iSQL:

START EXTERNAL ENVIRONMENT CLR; 

CALL ext_helloworld();

Which then gives me the following error:

Could not execute statement. Procedure 'ext_helloworld' terminated with unhandled exception 'Method 'Helloworld.n_cst_helloworld.of_hello' not found.'

SQLCODE = -91

So, I know that I have the object in the correct folder, and registered through REGASM and all that, otherwise it would give me the error of "object not found" that I'd seen before.

I'm confused because it seems that SQL Anywhere knows that the object n_cst_helloworld exists, but it doesn't recognize the methods that were generated using the PowerBuilder.NET utility. I don't know how to proceed to be able to use this method through ASA.

Currently I'm using ASA 12, PB12, PB.NET and have both 3.5 and 4.0 installed.

Community
  • 1
  • 1
  • Quick question-- in the project object did you mark the check-box of the function you wanted to export? If you see the object but not the method than I'm thinking this is what you may have forgotten. – Rich Bianco Aug 05 '13 at 18:45
  • Yes, it did make me use the checkbox. That checkbox was enabled. – Object-Oriented Disoriented Aug 05 '13 at 18:46
  • I think I may need a manifest file, but I have no idea how to create one... – Object-Oriented Disoriented Aug 06 '13 at 17:24
  • I have never used the CLR in this way but I wonder if it would help to use the PowerBuilder "Runtime Packager" to make sure that all necessary runtimes are deployed. You can find the Runtime Packager in the Start --> Programs --> Sybase --> Runtime Packager. HTH – Rich Bianco Aug 06 '13 at 17:33
  • Your response is really informative. I'm going to take the next hour or two and give these a try. I really appreciate it. – Object-Oriented Disoriented Aug 06 '13 at 19:14
  • I can run the following code: `>OLEObject o_hello >o_hello = create OLEObject >o_hello.of_connecttonewobject("helloworld.n_cst_helloword") >o_hello.of_hello()` this is not verbatum, so ignore case-sensitivity issues right now. I am frustrated because perfectly functional code is being manipulated clientside in our app, but I can't utilize the same code on ASA. I can't seem to get the formatting right, but each > is a new line. – Object-Oriented Disoriented Aug 06 '13 at 21:05
  • I had a feeling it would be difficult to make work using the ASA CLR mainly because of the PB run times but I was hopeful it would work... you are welcome. p.s. yah you can't format the comments, at least as far as I know. :) – Rich Bianco Aug 07 '13 at 22:22
  • I think I may have to develop directly in C# in order to get this to work ): – Object-Oriented Disoriented Aug 08 '13 at 12:47

1 Answers1

1

How .NET Deployment Works


When you deploy a .NET project, PowerBuilder compiles existing or newly developed PowerScript® code into .NET assemblies.

At runtime, the generated .NET assemblies execute using the .NET Common Language Runtime (CLR). PowerBuilder’s .NET compiler technology is as transparent as the P-code compiler in standard PowerBuilder client-server applications.

Deploying PowerBuilder runtime files

The simplest way to deploy PowerBuilder runtime DLLs and .NET assemblies to production servers or target computers is to use the PowerBuilder Runtime Packager tool. The Runtime Packager creates an MSI file that installs the files you select, registers any self-registering DLLs, and installs the .NET assemblies into the global assembly cache (GAC).


See full document PB.NET runtimes HERE on Sybase Infocenter


Checklist for Deployment

Verify that production servers and target computers meet all requirements for running the .NET targets that you deploy from PowerBuilder Classic.

Checklist for all .NET targets

For deployment of all .NET target types (Windows Forms, Web Forms, .NET Assembly, .NET Web Service), production servers or target computers must have:

  • The Windows XP SP2, Windows Vista, Windows 2008, or Windows 7 operating system .NET Framework 4.0
  • The Microsoft Visual C++ runtime libraries msvcr71.dll, msvcp71.dll, msvcp100.dll, msvcr100.dll, and the Microsoft .NET Active Template Library (ATL) module, atl71.dll
  • PowerBuilder .NET assemblies in the global assembly cache (GAC)
  • PowerBuilder runtime dynamic link libraries in the system path
  • See Deploying PowerBuilder runtime files.

See full set of deployment checklist documents HERE on Sybase Infocenter


Rich Bianco
  • 4,141
  • 3
  • 29
  • 48