Thomas ,
Hey Fernand,

thank you for your answer. Yes, this way works and I try this before,
but I work on a customer extension and this is the "badest option".
in this case yes its simpler to use a connection
What
I did not understand is why it was working last week but not this week??
And why in any case the error-massage returns localhost (127.0.0.1)?
There is still a open issue when connecting over the "internet" (IP out of your local range) maybe its the same problem ? Some hav e problems, others not ?


By the way: inserting data-rows in different tables with forein keys
seems to be a little bit "tricky"? To get the index (primery key) of the
just inserted row I tried to use "select from <table>
last_inserted_id()", but unfortunatly it does not work.
So I insert first a unigue string in a special field and use afterwards
a "select id from <table> where <field>='string'"
Then I complete the datarow and write afterwards the dependend rows to
other tables - not really perform.
We uses a similar technique producing our own unique foreign keys, where we always check the "exiting SQL data" before we write, I know , but every "locking" system had his price and when writing small peaces of data (what most OO-aplications do...) all goes at a low cost and very speedy. When "writing" data to the MySQL server we always uses "Dialogs" and "Statements instead off using "forms"so we have a better control over the data-integrity
How are you doing this job?

best regards
Thomas

Fernand Vanrie schrieb:
Thomas ,

To avoid problems like you desribed we nowadays uses the "com.sun.star.sdb.DatabaseContext" as a "binding" point to our MySQL server. So we place a OO-DB-document where all OO- users can acces the document with the lowest posible rights ( to avoid unwanted acces to the MySQL Tables) The we declare this DB-doc as a database in OO with a stadard name like "mysql_native"
For connecting we uses in our macro's:

oDB = CreateUnoService("com.sun.star.sdb.DatabaseContext")
oConn = oDB.GetByName("mysql_native").GetConnection("username","password")

We change "username" and "password" in our macro's (who are scrambled) depending on the aplication needs This aproach has also the advantage that you can make MySQL data available in the Beamer (Datasource browser)

Hope it helps




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to