Table of Contents
Introduction xxi
Who should read this book? xxii
How the book is organized xxiii
What you need to use this book xxiv
Code samples xxiv
Author online xxiv
Keep in touch xxv
Acknowledgments xxvi
PowerBuilder Developer's Library xxvii
Part I Distributed computing architecture and technology 1
1 Introduction to distributed computing 3
1.1 What is distributed computing? 4
1.2 Business challenges and distributed computing 6
1.3 Business application architectures 7
Monolithic/host-centric computing model 8
The client/server computing model 9
The network-centric/distributed computing model 13
1.4 Distributed computing and the enterprise 17
1.5 The Powersoft strategy 18
1.6 Summary 20
2 Transitioning the corporation to distributed computing 21
2.1 Choosing what to distribute 22
2.2 Planning the first project 23
2.3 Keys to success 23
2.4 The distributed application environment 24
2.5 Distributed computing is not a silver bullet 25
2.6 Challenges of programming in a distributed environment 25
2.7 Deciding when to distribute an application 26
2.8 Summary 26
Part II Distributed PowerBuilder 27
3 Distributed PowerBuilder overview 29
3.1 DPB overview 30
3.2 Why use DPB? 30
3.3 When to use DPB 31
3.4 Where to get DPB 31
3.5 DPB support 32
Communication Drivers 32
Platforms 32
3.6 DPB concepts 33
DPB objects 36
Establishing communication 36
The transaction object 38
Connection object 40
Transport object 41
Remote objects 43
Proxy objects and the PowerBuilder runtime 44
Application object 46
The client application 47
The server application 48
3.7 Creating proxies 50
3.8 Accessing a remote object 52
3.9 Destroying the object instance 53
3.10 Location transparency 54
Advantages of using only the proxy 55
3.11 The Hello World DPB application 56
Testing locally 58
Testing by using the local driver 59
Testing with loopback 61
Distributing over a network 65
Implementing location transparency 65
3.12 Summary 66
4 Writing DPB applications 67
4.1 The DPB server environment 68
4.2 How DPB works 73
Multitasking, threads, and the apartment model 73
4.3 ConnectionBegin and ConnectionEnd 74
4.4 Getting information on connections 75
Disconnecting clients from the server 79
Remotely stopping the server 79
4.5 Error handling 80
The connection object error event 80
4.6 Debugging 82
4.7 The trace facility 86
Reading the trace output 88
4.8 Compiling and deploying the application 92
4.9 Summary 93
5 Developing remote objects 95
5.1 The custom class user object 96
Building a custom user object 97
5.2 Getting our terms straight 100
5.3 Instantiating an object 100
Instantiating local objects 101
Instantiating remote objects 101
Assigning object references 103
Creating multiple instances 104
5.4 Destroying objects 105
Dropping an object reference 106
5.5 Objects, attributes, and methods 107
Attributes 107
Functions 108
Events 109
Choosing between events and functions 109
5.6 Calling methods 110
Calling functions or events 111
Static and dynamic method calls 111
Triggering and posting methods 114
Qualifying method calls 115
5.7 Restrictions on passing arguments to remote objects 116
5.8 Restrictions on return values for remote objects 117
5.9 Passing arguments to methods 117
Passing arguments 118
Passing object references 119
5.10 Summary 120
6 Database techniques 123
6.1 Database connectivity 124
6.2 Pooling database connections 127
6.3 Retrieving data 129
Embedded SQL 130
The DataWindow 133
The DataStore 135
6.4 Data retrieval using the client/server model 136
6.5 Data retrieval using DPB 140
Getting data using the DataStore 141
Using embedded SQL in place of a DataStore 142
Making additional changes 144
6.6 Getting data from the middle tier 146
Using the DataWindow on the client 147
Passing back data using a string 147
Using a structure to get data 150
Using an NVO in place of a structure to get data 153
DataWindow synchronization 157
6.7 Using the object notation on a DataWindow or DataStore 157
6.8 DataWindow children 158
6.9 Summary 163
7 Database updates 165
7.1 Handling data updates 166
Handling updates in DPB 167
7.2 DataWindow synchronization 179
How DataWindow synchronization works 180
Using DataWindow synchronization 180
Using DataWindow synchronization for updates 183
Using DataWindow synchronization with several targets or sources 188
7.3 Summary 190
8 Advanced concepts 191
8.1 Server push 192
How server push works 192
Passing object references to remote objects 192
What the server can do with remote references 194
Scope of the object and the object reference 196
Handling requests from the server 198
Deploying objects for server push 198
What happens when an object reference is passed to a remote object? 199
8.2 Asynchronous method calls and server push 201
Building a basic notify object 203
8.3 Shared objects 206
What is a shared object? 207
Building a shared object 208
Shared objects API 211
Creating a shared object 212
Using a shared object 214
Destroying shared objects 215
Obtaining a list of available shared objects 215
Handling requests 216
Managing shared objects 216
8.4 Multithreaded applications 217
8.5 Passing object references: dealing with complexity and deadlocks 218
8.6 Summary 220
9 DPB communications support 221
9.1 The local driver 222
The local driver and the connection object 224
9.2 Named pipes 224
Named pipes and the transport object 226
Named pipes and the connection object 226
9.3 WinSock 226
TCP/IP 226
The Internet Protocol (IP) 227
Communication between networks 230
Transmission Control Protocol (TCP) 231
TCP/IP and the transport object 232
TCP/IP and the connection object 232
Connection and transport options using TCP/IP 233
Installing TCP/IP on Windows 95/NT 233
Setting up TCP/IP 235
HOSTS and SERVICES files 237
Using DNS and WINS 238
Using IPCONFIG and WINIPCFG 238
9.4 Summary 240
10 Building an application server 241
10.1 Expanding the server functionality 242
Logging into the server 242
Autostart feature 242
Multi-transport management 242
Handling client connections 243
Load balancing 243
Server configuration 243
10.2 Setting up PowerBuilder 244
10.3 Building a custom transport object 245
Starting the transport 246
Stopping the transport 247
Initializing the transport 248
Handling the trace and option properties 251
Using the custom transport object 252
10.4 Building a custom connection object 252
Initializing the connection object 253
Connecting and disconnecting from the server 254
Getting connection information 256
Stopping the server remotely and disconnecting client connections 256
The error event 257
Using the custom connection object 259
10.5 Building a transport manager 259
The creation and destruction of transports 262
Using the transport manager 265
Managing the starting and stopping of transports 265
Providing connection and transport information 266
Disconnecting client connections 271
10.6 Building a DPB manager 272
Basic functions 273
Error logging 275
The security object 276
The server manager 277
Building the server manager 277
The client manager 282
10.7 Putting it all together 283
Customizing the server manager 284
The application object 285
The server interface 286
10.8 Summary 288
Part III PowerBuilder and the Internet 289
11 PowerBuilder and the Internet 291
11.1 Internet and Web primer 293
The Web browser 294
The Web server 296
Why move applications to the Web? 300
11.2 PowerBuilder Internet capabilities 303
O'Reilly's WebSite 1.1 304
Plug-ins 305
11.3 Plug-ins guidelines 320
DataWindow plug-in 320
Window plug-in 321
Window ActiveX control 321
11.4 Summary 321
12 Web.PB 323
12.1 Web.PB overview 324
Web.PB and the DPB environments 326
12.2 How Web.PB works 327
CGI and Web.PB 330
ISAPI and NSAPI 332
12.3 Setting up Web.PB 333
Installing the Web.PB file on the Web server 333
PBWEB.INI 333
The HOSTS and SERVICES files 335
A Web.PB checklist 335
12.4 Developing a Web.PB application 336
Calling functions through HTML 336
12.5 Building Web-enabled remote objects 345
CGI input 346
CGI output 346
CGI environment variables 352
12.6 Putting together the Web.PB application 354
A query screen 354
HTMLTable property 357
The employee detail and updates 360
12.7 Maintaining state in a Web application 365
12.8 Running a Web.PB application 366
12.9 Debugging the Web.PB application 366
12.10 Summary 366
Part IV PowerBuilder and the future 367
13 Beyond DPB 369
13.1 Component generators 370
13.2 Distributed solutions using PowerBuilder and COM 374
Building the Automation server in PowerBuilder 375
Accessing DPB from Visual Basic 377
13.3 Jaguar CTS 380
What is Jaguar CTS? 380
Jaguar CTS architecture 380
Jaguar server 381
Jaguar manager 384
Jaguar components 385
Jaguar client applications 388
PowerBuilder 6 and Jaguar CTS 390
13.4 Summary 390
14 The future of PowerBuilder 391
14.1 The future technologies 393
Distributed PowerBuilder 393
Component generators 394
PowerDynamo and PowerSite 396
Jaguar CTS 398
14.2 Summary 399
Appendix A Application partitioning and distributed computing 401
A.1 What is application partitioning? 402
A.2 Object-oriented design overview 402
A.3 Guidelines to designing distributable components 403
A.4 Application partitioning, a layered approach 404
Presentation 404
Business logic 405
Data management and file services 406
A.5 Why use application partitioning? 406
Reusable code 407
Maintainable code 408
Portable code 408
A.6 Application partitioning and application architecture 408
The host-centric model 409
Client workstations and the presentation layer 410
Database servers and data access 410
Fat client and fat server 411
Application servers 413
A.7 Guidelines to distributing components 413
Appendix B Enabling technology and middleware 415
B.1 What is middleware ? 416
B.2 Middleware layers 417
B.3 Network stacks 420
B.4 Inter-process communication middleware 420
B.5 Choosing middleware 421
Database access middleware 422
Native SQL API 422
Common SQL API 423
Database gateways 424
Middleware beyond the RDBMS 425
Sockets 426
Remote Procedure Calls (RPC) 427
Message-based middleware 429
Transaction Processing Monitors (TP Monitors) 429
Object Request Brokers (ORBs) 431
B.6 Distributed standards 432
Distributed Computing Environment (DCE) 432
B.7 Object-based IPC 434
RMI (Remote Method Invocation) 435
CORBA (Common Object Request Broker Architecture) 435
CORBA specifications 437
The ORB and how CORBA works 438
DCOM (Distributed Component Object Model) 440
B.8 Distributing PowerBuilder applications 444
Distributed PowerBuilder 444
OLE automation 445
Third-party toolkits 445
B.9 Summary 445
Appendix C Standard data types 447
Appendix D DPB objects and functions reference 449
D.1 DPB objects & functions 450
The ConnectObject 450
The connection object 450
The transport object 453
ErrCode results 454
Winsock options 454
Trace options 455
The application object 455
ConnectionInfo object 456
Shared Object functions 457
DataStore 459
Appendix E Where to find additional information 461
E.1 Web sites and news groups 462
PowerBuilder and Jaguar 462
Client/Server 463
CORBA 464
COM/DCOM 464
World Wide Web 464
ISAPI 464
InterNIC (Internet Network Information Center) 464
HTML and JavaScript 465
CGI 465
Security 465
E.2 Magazines and books 466
PowerBuilder 466
Client/Server 466
COM/DCOM 466
CORBA 466
TCP/IP 467
HTML and the Web 467
JavaScript 467
Development 467
Index 469