dbTalk Databases Forums  

jd3 & vb

comp.databases.pick comp.databases.pick


Discuss jd3 & vb in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
cc
 
Posts: n/a

Default jd3 & vb - 05-28-2005 , 10:15 AM






Hello to everyone

I would like to test jd3COM.dll library from VB5. Where can I find an
example about connecting to server and open/read a file?

Thanks in advance and best regards,

Cristian A. Clavero


Reply With Quote
  #2  
Old   
Christophe M
 
Posts: n/a

Default Re: jd3 & vb - 06-01-2005 , 05:47 AM






cc a écrit :
Quote:
Hello to everyone

I would like to test jd3COM.dll library from VB5. Where can I find an
example about connecting to server and open/read a file?

Thanks in advance and best regards,

Cristian A. Clavero

Hi, I'm afraid there is no yet tutorial about this one :-/

This one http://www.djpatterson.com/djpindex.html explain how to use jd3
in php. It's not the same langage, but the same philosophy in the object
orientation. So you could inspire you by this code.

Just a little exemple :

' Add reference to jd3com.dll
set con = new D3Connection()
set sess = con.createSession()
set file = sess.openFile("myaccount","myfile")
set rec = file.read("mykey")
msbox "My Record<1> :" & rec.extract(1)

' not tested but it must be something like that


Reply With Quote
  #3  
Old   
cc
 
Posts: n/a

Default Re: jd3 & vb - 06-01-2005 , 12:08 PM



Christophe,

I have opened a new project including reference to dj3com.dll, but
when I try to run the code the line:

set con = new D3Connection
^
VB returns error:
invalid use of new keyword

Any ideas ?


Reply With Quote
  #4  
Old   
Christophe M
 
Posts: n/a

Default Re: jd3 & vb - 06-02-2005 , 02:08 AM



cc a écrit :
Quote:
Christophe,

I have opened a new project including reference to dj3com.dll, but
when I try to run the code the line:

set con = new D3Connection
^
VB returns error:
invalid use of new keyword

Any ideas ?

Maybe some ideas:
- Have you "registered" the jd3com.dll ? to do this, go to "dos/cmd"
and type regsvr32 jd3com.dll
- Try something like : set con = new JD3COM.D3Connection
- And add a declaration for the con variable : Dim con as D3connection

A little and tested code :

Private Sub Command1_Click()
Dim con As D3Connection
Set con = New D3Connection

End Sub

If VB does not show you D3Connection in the "Intellisense box"
(ctrl-space), it should be that the COM library is not correctly
registered into Windows.

My 2 cents.


Reply With Quote
  #5  
Old   
cc
 
Posts: n/a

Default Re: jd3 & vb - 06-02-2005 , 08:35 AM



Chistophe

Thanks you for your kind reply.

Well, the library is registered and I can see it in the "Object
browser" window with all its methods.

About the "intellisense box", it shows me "D3Connection" (and the
others jd3 classes) in the line:
Dim con As [control-space]

But in the line
Set con = New [control-space]

The intellisense box doesnt show it.

Using jd3com.d3connection same result.


May be this one is for one of our VB experts at CDP !

Thanks any way !


Cristian


Reply With Quote
  #6  
Old   
Kevin Powick
 
Posts: n/a

Default Re: jd3 & vb - 06-02-2005 , 11:50 AM



cc wrote:

Quote:
About the "intellisense box", it shows me "D3Connection" (and the
others jd3 classes) in the line:
Dim con As [control-space]

But in the line
Set con = New [control-space]

The intellisense box doesnt show it.
I don't know anything about jd3, but maybe the jD3Connection object
needs to be instantiated via the method of another class.

For example, when using the OBjEX library of the jBASE multi-value
product, you do the following

Dim jb as jBASE
Dim Con as jConnection

Set jb = New jBASE
Set Con = jBase.Connect

So maybe you do something similar with jD3:

Dim MyjD3 as jD3
Dim Con as jD3Connection

Set MyjD3 = new jD3
Set Con = MyjD3.Connect

Just a shot. Hope it helps.

--
Kevin Powick


Reply With Quote
  #7  
Old   
Mark Brown
 
Posts: n/a

Default Re: jd3 & vb - 06-02-2005 , 01:21 PM



You can't use the NEW keyword on an object that can't be created without
parameters.

To create a D3Connection object, you need some parameters like a connection
string.

I'm not familiar with that term JD3. Who/what are they and where do they
come from? What's the root object from which the D3Connection is created?
That's what needs to be set up as NEW as in (D3 example):

set E = NEW clsD3Environment
set CON = E.brOpenConnection("ODBC",dsn_name)

To create the connection object (in odbc), you need two parameters which
cannot be supplied via the NEW keyword.

Mark Brown


"cc" <cristianclavero (AT) topmail (DOT) com.ar> wrote

Quote:
Chistophe

Thanks you for your kind reply.

Well, the library is registered and I can see it in the "Object
browser" window with all its methods.

About the "intellisense box", it shows me "D3Connection" (and the
others jd3 classes) in the line:
Dim con As [control-space]

But in the line
Set con = New [control-space]

The intellisense box doesnt show it.

Using jd3com.d3connection same result.


May be this one is for one of our VB experts at CDP !

Thanks any way !


Cristian




Reply With Quote
  #8  
Old   
cc
 
Posts: n/a

Default Re: jd3 & vb - 06-02-2005 , 04:03 PM



Kevin and Mark,

Thanks for your help and examples.

JD3 is an open source project written by Christophe Marchal to provide
a client/server interface to D3 via TCP sockets. It is at
www.sourceforge.net/projects/jd3

The project includes PHP, Java and COM clients. For the COM client
there is a library (jd3com.dll), but without documentation or
examples(yet).

So, looking at the Object browser window, I see the library and its
classes but, none is defined as 'root' object.

The thing is that after the NEW keyword the 'intellisense box' doesn't
show that library as an option , so when I code:

Set con as New D3Connection

I get the message "invalid use of new keyword"

(by the way, I have tried your example with the d3/odbc library and the
code runs fine)


Best regards,


Cristian


Reply With Quote
  #9  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: jd3 & vb - 06-03-2005 , 02:30 AM



"cc" <cristianclavero (AT) topmail (DOT) com.ar> wrote:
Quote:
Set con as New D3Connection
I get the message "invalid use of new keyword"
That should be:
Dim con as New D3Connection ' early binding
OR
Dim con as D3Connection
....
Set con = New D3Connection ' late binding

I haven't looked at the JD3 DOM so I don't know what the constructor
arguments are for the D3Connection class, sorry.

HTH
T


Reply With Quote
  #10  
Old   
Tony Gravagno
 
Posts: n/a

Default Re: jd3 & vb - 06-03-2005 , 02:30 AM



Christophe, this is as good a place as any to ask this question:

If your socket server in D3 dies, can you start a new server on the
same socket port? I've had this argument with RD for a long time but
I haven't taken the time to check current platform behavior. I know
in the past that if the D3 PIB running a server process dies that it
takes with it the handle to the socket. D3 still "owns" the handle
but no longer has a reference to it. The OS has no idea that the
socket is unavailable, it still thinks the socket is in use and will
therefore not allow a new server process to be started on that same
port. The only remedy used to be to reboot D3, which then released
all resources including the socket.

I've written some very stable client and server code using D3 sockets
but a long time ago I realized that if the D3 process failed for
whatever reason, that my code would not be able to restart. I didn't
want my phone to ring with an upset client, where I'd have to explain
to them that they needed to reboot D3 in order to use my software
again. So I decided to stop using D3 as a socket server and only make
client connections From D3 into a network that handled things better.

So after all of this I'd like to know if you've experienced any of
this and how JD3 handles it? To test: start a JD3 server, then
reset-user on the PIB. Using (kill -9) on the PID might be a good
brutal test too.

I'd do the testing myself but I simply don't have time to waste on
stuff that I've already wasted so much time on so many years ago. I
know RD hasn't touched this code in years but they maintain the
problem doesn't exist. Sorry, but I'm not getting paid to do QA
(anymore).

FWIW, another argument against a D3-based socket server is that you
can't hand off process handles like a web server does, so every
connection must complete in a single-threaded fashion before another
one can be used. The only alternative is to have multiple server
processes all listening on different TCP/IP ports, which isn't
practical. This problem can be worked around in Linux by linking a
custom comms module into the D3 monitor, but that's not practical for
production user sites either.

Thanks for your comments.
Tony

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.