Inserting vCards By Hand

I just started preparing for the eventual migration of our server to 2.2.0, and I have a question about the new jiveVCard table and inserting records by hand.

Currently we insert values into the jiveVCard table through a web registration app. This has worked fine up to 2.1.5.

However, I just tested the latest nightly build and this no longer seems to work.

My insert query looks like this:

INSERT INTO jiveVCard (username, value)

VALUES (’‘John’’, ‘’’’);

Inserting the record works correctly, however when any user requests the vCard info, the server returns nothing.

I know this is a strange situation, and not the normal use of Jive Messenger, but any help would be great.

Hey Disruptor,

The INSERT statement that you posted is using an uppercase letter in the username. Since uppercase letters are not allowed in JIDs, my guess is that that vCard won’'t match with any user. Make sure that the username value matches the username of the users in your system.

One thing you may try is create a vCard from an XMPP client and then compare the stored data in the database with the one you are generating.

Regards,

– Gato

I should have picked a better fake JID.

The tests that I have done have all used lowercase usernames.

Also, I did have a client create the vCard data, that I how I originally got the syntax of the record to insert.

Any other ideas by chance?

The server is using a cache so make sure to restart the server after you have imported all the vCards. Is the client getting an error when requesting his vCard?

Regards,

– Gato

Interestingly, I thought it might be something like that, and I restarted the server. No luck though, it didn’'t make any difference.

As for errors, I looked at the debug xml on Exodus, and the client it getting the info, just the fields are empty.

Like this:

Ok. That is weird.

When the server doesn’'t find a vCard an empty vCard element is returned. Since you are getting a vCard but with no information then the problem should be another issue. Is it possible for you to debug the server code? You should debug DefaultVCardProvider#loadVCard(String) to see why the text inside the XML elements is being lost. BTW, could you check if that information is present in the database?

Regards,

– Gato

I am using SQL Server for the database, and I logon to the Query Analyzer, and do something like

SELECT * FROM jiveVCard

So I am positive that the correct records exist in the database.

As for debugging, I’'m afraid I am not familiar with any Java debugger, but if you point me in the right direction I could probably figure it out.

Disruptor,

My question about the db checking was not if the table is empty but if there is some text inside the stored XML elements. Could you send me 2 INSERT statements that you are using so I can try reproducing the problem locally?

Thanks,

– Gato

Here you go:

INSERT INTO jiveVCard (username, value)

VALUES (’‘rwilson’’, ‘’’'s into html…

Hey Disruptor,

I thought that the initial SQL statement was not complete but now I see that the vCard element is not being terminated. Could you add a after ?

Regards,

– Gato

Ok, I just added to my INSERT statement.

It said 1 rows affected, looks good.

But then I ran a SELECT * FROM jiveVCard and the that I added to the statement isn’'t there. ?

To discard that it is not a UI issue, restart the server and try loading the vCard for the user that you added the closing vCard element. If that didn’'t work then you should try to figure out why the database (MS-SQL) is filtering the closing of the vCard element.

Regards,

– Gato

Ok, restarted the server and still the same problem.

Something must be wrong with the SQL Server. I’'m not sure why it would truncate the last part of my insert statement.

Thanks for all of your help Gato, I really appreciate it.

No problem. Let us know when you find out the reason for the strange DB behavior.

Saludos,

– Gato

Oh, one more thing to try. Save a vCard using an XMPP client and check if that information is being stored correctly in the database.

– Gato

I just compared the debug XML output from Exodus to what was stored in the database, and there is quite a bit missing…

All of this is cut off:

Hey Disruptor,

In Exodus, try storing information in the work address section (or complete all the fields). Restart the server and then retrieve the vCard using exodus. If the information is missing then the database truncated the data (very weird), otherwise the db tool that you are using is not showing the complete data.

Let me know how it goes.

Regards,

– Gato

It looks like I have gotten it to work.

In Query Analyzer I went to Tools -> Options -> Results tab -> I set maximum characters per column higher than what it was (256).

I inserted a vCard record by hand, and it works.

Thanks again.