List Info

Thread: Base data source




Base data source
user name
2007-06-07 17:41:00
Dear OO API community:

Is it possible in Java API to load existing *.odb files (or
other types
of databases) without defining data sources?  Pointer to
example code is
appreciated.  Thanks.

Ray

-----

References:

api.openoffice.org/servlets/BrowseList?list=dev&by=threa
d&from=1316694
openoffice.org/servlets/ReadMsg?listName=dev&msgNo=14730

URL for new base document 

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


2.2.0 Base data source
user name
2007-06-08 08:22:39
Dear OO API community:

Base GUI 2.2.0 supports the loading of existing *.odb files
that do not
have prior registrations in data source list.  Base does not
seem to
create any additional data source definition during and
after the
loading either.

Is it possible to achieve the same in Java API?
Is it possible to load existing *.odb files and other types
of databases
without defining data sources?

Pointer to Java example code is appreciated.  Thanks.

Ray

-----

References:

api.openoffice.org/servlets/BrowseList?list=dev&by=threa
d&from=1316694
openoffice.org/servlets/ReadMsg?listName=dev&msgNo=14730

URL for new base document 

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Base data source
user name
2007-06-11 04:33:02
Hello Ray,

> Is it possible in Java API to load existing *.odb files
(or other types
> of databases) without defining data sources?  Pointer
to example code is
> appreciated.  Thanks.

This is possible with the usual
XComponentLoader.loadComponentFromURL
call, issued at the css.frame.Desktop object. I don't have
any sample
code at hand, but I'm pretty sure you'll find a lot if you
search the
net for it.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer        
frank.schoenheitsun.com -
- Sun Microsystems                      http://www.sun.com/star
office -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Base data source
user name
2007-06-12 17:16:22
Dear Frank:

Thanks for the advice.  As regarding the need of

> * How to extract java.sql.Connection from a
sdbc.XConnection?
> There's no way to do this - what do you need it for?

This need is vital for business case.  Product managers will
not
fund the development unless the code maintenance, etc., is
user
friendly.
Pleas notice *maintenance", not just features.  See
below for details.

java.sql.Connection           jj_cnct;
com.sun.star.sdbc.XConnection oo_cnct;
oo_cnct = ...;     // require *.odb ZIP decompression
jj_cnct = UnoRuntime.queryInterface(
java.sql.Connection.class, oo_cnct
);
jj_cnct = oo_cnct.getJDBCconnection();
// Would the polymorphism notion work as an alternative?
// do_universal_JDBC_SQL_processing( jj_cnct, jdbc_cnct_1,
jdbc_rdbms_2,
... );
oo_cnct.close();   // require *.odb ZIP compression

Is there a way to accomplish this conversion?

Ray

 -----

I have had the feeling that this question will surface
sometime.  
It has to do with the difference of operating environments
between
personal applications and medium size (dept., division,
etc.)
businesses.  
Similar problems [1] have occurred with Calc, Base, API as I
was trying 
to demonstrate a concept feasibility.

Medium size businesses often have resources to collect and 
maintain multiple groups/types of business intelligence
data.  
A typical analysis algorithm needs access to multiple data
stores, 
usually in different database engines.  Currently JDBC
databases 
greatly outnumber SDBC databases.  It is a nightmare for
both 
maintenance and future design revision to duplicate all
existing 
and future JDBC SQL algorithm code (java.sql.Connection) 
to another set specifically for sdbc.XConnnection.  
Imagine the cost of double checking both sets of codes, 
potential liability, etc.  

No sensible product manager would ever allow this situation.
 
Hence there is a critical need for the conversion between 
Connection and XConnection.

I use Calc as the GUI for Base for business reasons that
might be apparent to people in medium size businesses, but
that might be overlooked by developers of personal
applications.
There has been much effort in Base form and Base report.
These features are popular for personal applications.
They are not fit for medium size business need, however.
Imagine the entry of thousands of records through any form.
Imagine telling colleagues to convert spreadsheet files
of thousands of lines of input records into other formats.
Imagine telling colleagues to learn Base GUI for report
generation.
They much prefer spreadsheet environment for analysis and
report.

Similarly Java or OO Datasource repository is avoided since
it is an obvious target for hacker attacks.

[1] 2.0.4 Base linked tables

http://dba.openoffice.org/servlets/ReadM
sg?listName=users&msgNo=4116
http://dba.openoffice.org/servlets/ReadM
sg?listName=users&msgNo=4114
(**)
http://dba.openoffice.org/servlets/ReadM
sg?listName=users&msgNo=4130
(**)

Similar issues also happened for Calc and API.

 ----

To summarize for other readers:

Subject: get sdbc.Xconnection for existing *.odb files
         that are not registered in data sources and
         without creating additional data source
registration.
Language: Java (stand alone Beanshell)

* approach 1: getByName()

// OO Developers Guide 2.0, section 12.2.1 DatabaseContext
(near end),
p.832
// quote: Since OpenOffice.org 2.0, getByName() can also be
used
// to obtain data sources that are not registered.
import com.sun.star.uno.UnoRuntime;
import java.sql.Connection;
import com.sun.star.sdbc.XConnection;    // not
com.sun.star.connection.XConnection
import com.sun.star.sdbc.XDataSource;    //
javax.sql.DataSource
import com.sun.star.container.XNameAccess;
Connection  jj_cnct;
XConnection oo_cnct;
XDataSource dsrc;
XNameAccess lsts;  // data source list
Object      prxy;
lsts = ...  // get the data source list from database
context
prxy = lsts.getByName( "file:///d:/test 01.odb"
);
dsrc = UnoRuntime.queryInterface( XDataSource.class, prxy
);
oo_cnct = dsrc.getConnection( "sa", ""
);

* approach 2: loadComponentFromURL()

XDatabaseDocumentUI  base_uiui;  // unpublished API in 2.0
XController     base_cntl;
XModel          base_modl;
XComponent      base_cmpt;
XConnection     oo_cnct;
Boolean         okok;
Base_cmpt = XComponentLoader.loadComponentFromURL( ... );
base_modl = UnoRuntime.queryInterface( XModel.class,
base_cmpt );
base_cntl = base_modl.getCurrentController();
base_uiui = UnoRuntime.queryInterface(
XDatabaseDocumentUI.class,
base_cntl );
okok      = base_uiui.connect();
oo_cnct   = base_uiui.ActiveConnection;

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Base data source
user name
2007-06-13 02:23:43
Instead of using the linked tables method and openoffice
base... why
dont you use the java.sql.connection class library
directly?... you
can use the full java.sql.* library api set from within Java
UNO
client application. Instead of using the OOOBase driver
manager you
just have to use java.sql.DriverManager library....to
connect any JDBC
datasource....

 (I have not used beanshell, but it should be possible,
since
beanshell is a scripting layer over java...)

On 6/13/07, Jahn, Ray (R.) <rjahn1ford.com> wrote:
>
> [1] 2.0.4 Base linked tables
>
> http://dba.openoffice.org/servlets/ReadM
sg?listName=users&msgNo=4116
> http://dba.openoffice.org/servlets/ReadM
sg?listName=users&msgNo=4114
> (**)
> http://dba.openoffice.org/servlets/ReadM
sg?listName=users&msgNo=4130
> (**)
>
> Similar issues also happened for Calc and API.
>
>  ----

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Base data source
user name
2007-06-21 22:54:30
I demonstrate how to do this in AndrewBase.odt on my web
site (the 
database page). My examples are macros, not in Java.

Jahn, Ray (R.) wrote:
> Dear OO API community:
>
> Is it possible in Java API to load existing *.odb files
(or other types
> of databases) without defining data sources?  Pointer
to example code is
> appreciated.  Thanks.
>   

-- 
Andrew Pitonyak
My Macro Document: http://www.pi
tonyak.org/AndrewMacro.odt
My Book: http://w
ww.hentzenwerke.com/catalog/oome.htm
Info:  http://www.pitonyak.or
g/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )