PHP COM Connection To Domino
Okay, with one hurdle in the Notes->PHP conversion out of the way (if you haven't guessed already, this blog is fast turning in to the misadventures of a man on a mission), the next is the data itself. How do I get the data from Notes in to MySQL? Well, one of the obvious solutions is to use something like DECS or NotesPump. Not me. Don't trust them as far as I could....
What I've done is write yet more PHP. This time it connects to the Notes server using COM (Thanks to the JunkHeap PHPDOM project for their example file that got me started) and dynamically creates a series of SQL INSERT statements after formatting the text. I can then save this as a text file and dump it in to MySQL. Et, viola, here's the code. The result is text that you can save to a .sql file like this.
If you're getting really excited about the fact that PHP can get to Notes data via COM. Don't. It wasn't long before this is what PHP was telling me:
Warning: Invoke() failed: Exception occurred.
Source: NotesDocument Description: Notes error: Maximum number of memory segments that Notes can support has been exceeded in D:\HTML\codestore\sqlexport.php on line 41
Probably my fault...
Are you still going to be a Lotus Site? Or are you going to start writing about PHP?
Just curious. It will be a shame to loose this resource.
Methinks that is terribly platform dependant (do all you poeple use Windows ?)
How about having a Domino Agent which generates XML for you. You could then (even on a separate machine) read in that XML and parse it w/ PHP to have it inserted into your MySQL database.
Oh, BTW: I'd suggest doing `INSERT INTO articles (c1,c2,c3) VALUES (v1, v2,v3)' thereby catering for later structural changes to the DBMS
Couldn't you have used JDBC on a Domino agent to connect to MySQL directly? Would make a nice Domino article....
I'll second Chris' idea for an article!
I doubt jake is going to conver this from a Lotus resource to a PHP resource (well I hope not) purely for the fact that - half of us aren't interested in learning PHP, so his user base will be lost - and the fact there there are a 1000 and 1 php resources out there - but only a handfull of good notes ones - and in that hand I can only think of 3!
But this is an interesting project which to follow through - I must might the bullet one day and learn php, java and xml - there's always so much to learn! - i'm trying to be as general as possible in my skills - so I can get a job wherever I choose to live - but damn it's hard work!
I agree with you, prawnFresh. A developer shouldn't be depending on one platform or language. Therefore, I think it's excellent that Jake is doing things like servlets and php besides all the Domino stuff. I think even for Jake this is his way to be less depending on the uncertain future of Lotus/Domino. I think we should also take an active and open approach to new technologies and do what Jake's doing.
I really don't think PHP and other web-based technology should be shocking to Domino developers. I mean, PHP is still just generating dynamic HTML from a database, like I was doing 7 years ago with ASP and have been doing for the last few years with Domino. If you have a solid programming foundation, its easy to learn a new language like PHP, especially when there's good resources like this site.
It seems like the simplest way to get the data (even simpler than JDBC) would be to use LS:DO with ODBC. Then you could push the data directly into the SQL tables.
I'll move my site www.dominocode.net to PHP, and I'm a Domino fan.
That does'nt mean that I'll quit talking about Domino, in fact, I become a WEB developer, not just a Domino developer.
And the main issue, hosting.
here where I live there's no Domino hosting and I'll not paying extra $$$ for a Domino hosting outside my country, when I can have Linux/Apache/PHP/mySQL for US40.- a year (and I'm not joking)
Never forget that a great site is because its content not where is hosted or which plaform is used to serve the content.
So, go ahead Jake let's move ;o)
.::AleX::.
Dominocode.Net
Glad to see that most of you are getting it. You're not going to "lose a resource". I'm talking about importing data. Does this not tell you that they site's content will remain?
In short - I will blog about whatever I like and I will write articles about whatever I am doing at work/find interesting.
Like it or leave it.
I "like it". My only concern is that it will no longer be an example of how Domino sites CAN look. But four letters come to mind: XHTML
Yes, I agree. We need a good Domino site to point. It really is a great platform.
If the people who know it best are abandoning it, who can blame anyone for the bad press it receives. I think we need to start talking it up, not the down. I mean what else has security, logging, database, replication, etc. in a single file. Lotus Notes rocks!
"...But four letters come to mind: XHTML"
That's five letters.
Yeah, alright Jimmy. Very good. You heard it here first, Notes developers can't count.
Try DECS.
It's free (with at least one of the Domino distros). It works.
Not a *single* line of code to write. Sorry geeks.
Why re-invent the wheel for the fourteen millionth time ???
Regards, Ron
"1 from the top please, Carol, and 4 from anywhere else..." ;)
Tim, there are other decent examples of Domino sites that look good though. I'm working on one myself, nothing to do with Domino, it's about motor racing, but I'm trying to make it as good an example of how good Domino sites can look as codestore. Whether or not I succeed is another thing altogether!
I've said it before and I'll say it again. There is no reason whatsoever that you can't make a Domino site look just as good as a site designed on any other platform.
At risk of repeating myself even further: Do NOT let Domino create your HTML. DIY!
Domino sites can look just as good as any other sites example:
http://www.shropshire-cc.gov.uk/vacancy.nsf - simple but effective.
If you wait till January you'll be able to see the full Shropshire County Council site done in domnio. with NO tables! (apart from what content editors put in - but we're tryin to stop them doing that!)
"Do NOT let Domino create your HTML. DIY!"
Yeah. But as you've blogged on before, Domino won't LET us have totally full control over it ALL.
"<BODY TEXT="000000" BGCOLOR="FFFFFF">" for example.
Domino also knackers the creation of valid XHTML, and if it didn't, I suspect the platform wouldn't lose such sites to PHP.
I'm gonna plough on with my XHTML/CSS body content with no layout tabling in Domino regardless, but it's a shame the R6 release hasn't done enough to let Domino web developers have full control, something that has lead to people like yourself getting exited (and rightly so) about alternatives. A lot of the R6 stuff looks great. But Domino still insists on trying to do too much of the developer's markup for him/her. At least that's what's been reported to me.
Aaargh! That BODY tag is a sod... I had to do a real hack yesterday to get a custom form in before Domino dumped its own one in ($$SearchTemplate) -- and the HTML Body attributes section was the place to do it.
Which is OK of you can I suppose...
How about NotesRichtext Fields ?
is can be saved into mySQL too ?
if can be saved, then how to do that ?
thanks.