Info@RikHustede | 3 Mar 19:40 2011
Picon

How to establish an activeConnetion on launching Openoffice.org BASE with embedded HSQLDB

Hello together,
 
I'm new here, and i have a serious problem with my Base DB with embedded HSQLDB.
I'm not shure, if the problem exists 'cause of my Hard- and Software combination or if it's a serious bug in Base.
Using OOo 3.3-Base, Windows 7 and tryed out JRE 1.6.0_20/22/24 the problem exists with all of them:
 
When launching Openoffice.org BASE with embedded HSQLDB and directly open a form or dialog via basic macro,
all inserted and changed datas are lost on closing the database document.
 
That means, opening a Form in code does work, and I can see the datas of the HSQLDB in the form.
They also can be changed. Reopening the form via code shows the changed datas, i think they are written to cached tables, but not to the hard disk.
By closing the database-document, all added or changed datas are lost.

With xray I found out, that there is no "activeConnection" into HSQLDB established by opening forms or dialogs on this way.
 
When i change once  into "Table view", then "thisComponent.currentcontroller.activeConnection" can be seen with Xray, otherwise it's a "Null Object".
In this case, all added and changed datas will be written to the embedded HSQLDB, nothing lost.
 
 
Does anybody know, how to establish the "activeConnection" via Basic?
 
 
Rik Hustede
 
 
Frank Schönheit | 4 Mar 09:17 2011
Picon

Re: How to establish an activeConnetion on launching Openoffice.org BASE with embedded HSQLDB

Hello Rik,

> When launching Openoffice.org BASE with embedded HSQLDB and directly
> *open a form* or dialog *via basic macro*,
> *all inserted and changed datas are lost on closing the database document*.
> ...

There are various ways how you could do this. I tend to saying that in
neither case, the changes you do to the data should be lost. (Though
there might always be strange ways you could do things, and sometimes,
caring for each such strange way might be ... expensive.)

> Does anybody know, how to establish the "activeConnection" via Basic?

ThisComponent.CurrentController.connect() is the preferred way, it does
effectively the same as is done when you connect via the UI. From this
point onwards, all sub components, including the forms you open
programmatically, use the very same connection, so your data problem
should vanish.

Ciao
Frank
--
-----------------------------------------------------------------
To unsubscribe send email to users-unsubscribe <at> dba.openoffice.org
For additional commands send email to sympa <at> dba.openoffice.org
with Subject: help

Rik | 5 Mar 20:59 2011
Picon

Re: How to establish an activeConnetion on launching Openoffice.org BASE with embedded HSQLDB

Hello Frank,
Thanks, that's it: ThisComponent.CurrentController.connect()
all problems solved!

Thank you.
Rik

--
-----------------------------------------------------------------
To unsubscribe send email to users-unsubscribe <at> dba.openoffice.org
For additional commands send email to sympa <at> dba.openoffice.org
with Subject: help

Rik | 7 Mar 16:10 2011
Picon

Re: How to establish an activeConnetion on launching Openoffice.org BASE with embedded HSQLDB

Hello Frank,
i've one more question.
Do you know, why Base, with embedded HSQLDB, does not direct ...connect()to the
HSQLDB on opening the database document?
Was that the same in 3.2.1?
I can't remember having had such problems with 3.2.1.

Rik

--
-----------------------------------------------------------------
To unsubscribe send email to users-unsubscribe <at> dba.openoffice.org
For additional commands send email to sympa <at> dba.openoffice.org
with Subject: help

Frank Schönheit | 8 Mar 09:30 2011
Picon

Re: How to establish an activeConnetion on launching Openoffice.org BASE with embedded HSQLDB

Hello Rik,

> Do you know, why Base, with embedded HSQLDB, does not direct ...connect()to the
> HSQLDB on opening the database document?
> Was that the same in 3.2.1?
> I can't remember having had such problems with 3.2.1.

Not sure I get the question - do you mean OOo should automatically
connect to the DB upon opening the DB-doc? In this case: No, it never
was this way, and the behavior is intentional so far: Connecting might
be expensive, and popup a possibly disturbing login dialog, so we do it
only when needed.

Ciao
Frank

--

-- 
ORACLE
Frank Schönheit | Software Engineer | frank.schoenheit <at> oracle.com
Oracle Office Productivity: http://www.oracle.com/office
--
-----------------------------------------------------------------
To unsubscribe send email to users-unsubscribe <at> dba.openoffice.org
For additional commands send email to sympa <at> dba.openoffice.org
with Subject: help

Fernand Vanrie | 4 Mar 09:22 2011
Picon

Re: How to establish an activeConnetion on launching Openoffice.org BASE with embedded HSQLDB

Rik,

normaly for a OO-Dbase connectyed to MYSQL i use

   oDB = CreateUnoService("com.sun.star.sdb.DatabaseContext")
   if not oDB.hasbyname("OODbaseName")then
   oDB.registerDatabaseLocation("mOODbaseName",converttoURL("Path to OODbasename.odb")
   endif
   oConn = oDB.GetByName("OODbaseName").GetConnection("User","Password")

Hope it helps
Fernand
Hello together,
 
I'm new here, and i have a serious problem with my Base DB with embedded HSQLDB.
I'm not shure, if the problem exists 'cause of my Hard- and Software combination or if it's a serious bug in Base.
Using OOo 3.3-Base, Windows 7 and tryed out JRE 1.6.0_20/22/24 the problem exists with all of them:
 
When launching Openoffice.org BASE with embedded HSQLDB and directly open a form or dialog via basic macro,
all inserted and changed datas are lost on closing the database document.
 
That means, opening a Form in code does work, and I can see the datas of the HSQLDB in the form.
They also can be changed. Reopening the form via code shows the changed datas, i think they are written to cached tables, but not to the hard disk.
By closing the database-document, all added or changed datas are lost.

With xray I found out, that there is no "activeConnection" into HSQLDB established by opening forms or dialogs on this way.
 
When i change once  into "Table view", then "thisComponent.currentcontroller.activeConnection" can be seen with Xray, otherwise it's a "Null Object".
In this case, all added and changed datas will be written to the embedded HSQLDB, nothing lost.
 
 
Does anybody know, how to establish the "activeConnection" via Basic?
 
 
Rik Hustede
 
 

Fernand Vanrie | 4 Mar 09:41 2011
Picon

Re: How to establish an activeConnetion on launching Openoffice.org BASE with embedded HSQLDB

Rik,

Me again :-)

found a complete sub who works on HSQLDB but also not run from in the BaseDoc itself

Sub SaveToDB (path as string)
oSrcFilePath = ConvertToUrl(path)
oFileAccessService = createUnoService("com.sun.star.ucb.SimpleFileAccess")
oTextInputStream = createUnoService("com.sun.star.io.TextInputStream")
oTextInputStream.setInputStream(oFileAccessService.openFileRead(oSrcFilePath))
'xray oTextInputStream
ss =  oTextInputStream.readstring(array(),false)

   oDatabaseContext = createUnoService("com.sun.star.sdb.DatabaseContext")
   oDataSource = oDatabaseContext.getByName("ODF_test_PI")
   oConnection = oDataSource.GetConnection("","")

' prepare the Statement
 sSQL = "INSERT INTO TEST(HTML) VALUES(?)" 
 Statement = Oconnection.PrepareStatement(sSQL)
' insert ss for ( ? ) placeholder 1

 Statement.setString(1,ss)

' write to Database ( Use iAccess to check Success if you want)
   iAccess = Statement.executeUpdate()
   print iAccess
    if iAccess = 1 then
  ' oSimpleFileAccess.kill( path )
   endif

sStatement = oconnection.createstatement  
sSQL = "Select * from TEST where AUTO = 119"
  sStatement.execute(sSQL)
   resultset = sstatement.getresultset
   resultset.next
  ' xray resultset
   sHTML = resultset.getString(3)
    
   InsertHTMLContent(sHTML)

End Sub
Rik,

normaly for a OO-Dbase connectyed to MYSQL i use

   oDB = CreateUnoService("com.sun.star.sdb.DatabaseContext")
   if not oDB.hasbyname("OODbaseName")then
   oDB.registerDatabaseLocation("mOODbaseName",converttoURL("Path to OODbasename.odb")
   endif
   oConn = oDB.GetByName("OODbaseName").GetConnection("User","Password")

Hope it helps
Fernand
Hello together,
 
I'm new here, and i have a serious problem with my Base DB with embedded HSQLDB.
I'm not shure, if the problem exists 'cause of my Hard- and Software combination or if it's a serious bug in Base.
Using OOo 3.3-Base, Windows 7 and tryed out JRE 1.6.0_20/22/24 the problem exists with all of them:
 
When launching Openoffice.org BASE with embedded HSQLDB and directly open a form or dialog via basic macro,
all inserted and changed datas are lost on closing the database document.
 
That means, opening a Form in code does work, and I can see the datas of the HSQLDB in the form.
They also can be changed. Reopening the form via code shows the changed datas, i think they are written to cached tables, but not to the hard disk.
By closing the database-document, all added or changed datas are lost.

With xray I found out, that there is no "activeConnection" into HSQLDB established by opening forms or dialogs on this way.
 
When i change once  into "Table view", then "thisComponent.currentcontroller.activeConnection" can be seen with Xray, otherwise it's a "Null Object".
In this case, all added and changed datas will be written to the embedded HSQLDB, nothing lost.
 
 
Does anybody know, how to establish the "activeConnection" via Basic?
 
 
Rik Hustede
 
 



Gmane