Ludovic Coum�tou (aka Coume) wrote:
On Sat, 2005-04-16 at 20:30 +0000, Andrew Douglas Pitonyak wrote:
Hello,
Ok I finally have time to access the laptop and play around...
So the first part of the script works well, it displays me a window with
the data in my Calc, except the first line.
That is by design. It assumes that the first row contains labels.
I I have trouble with the connexion to the mySQL DB :(Yes, it fails. You do not have the AppendProperty method :-)
sUser$ = "openoffice"
sPass$ = "xxxxx"
sURL$ = "sdbc:odbc:localhost:3306" <- my mysql db is on my
localhost, I don't know if that's the correct setting
oManager = CreateUnoService("com.mysql.jdbc.Driver") <-
That's the driver user for the connexion ?
AppendProperty(oParms(), "user", sUser) <---- ERROR
AppendProperty(oParms(), "password", sPass)
oCon = oManager.getConnectionWithInfo(sURL, oParms())
End Sub
==== end ====
When I try to run the script, I get an error on the AppendProperty line.
==== begin ====
Basic Runtime error:
Sub-procedure or function procedure not defined
==== end ====
My intention was simply to show you which properties to use. You probably want to simply use something like
Dim oParms(1) as new com.sun.star.beans.PropertyValue
oParms(0).Name = "user"
oParms(0).Value = sUser
oParms(1).Name = "password"
oParms(1).Value = sPass
If you use ODBC, you should only require something like:
sURL$ = "sdbc:odbc:ODBCNAME"
You must configure the ODBCNAME ahead of time. Consider the following: ******************
ODBC (Open DataBase Connectivity), pronounced as separate letters, is a standard database access method developed in 1992 by the SQL Access group. ODBC is a middle layer between a DBMS (database management system) and an application. ODBC translates data queries into commands that the DBMS understands. SDBC knows how to talk to an ODBC data source.
An ODBC data source must be registered before it can be used. Use the ODBC Data Source Administrator to add and configure an ODBC data source on Windows. Use the control panel (Start | Settings | Control Panel) to open the Control Panel. With Microsoft Windows 2000 or newer, use Administrative Tools | Data Sources (ODBC) to open the ODBC Data Source Administrator (see Figure 4). For older versions of Windows, use 32-bit ODBC or ODBC.
I used ODBC to connect to a set of existing Paradox tables. I was very happy to find out that Windows XP Professional came with drivers for Paradox, and many other database systems, already installed. The macro in Listing 39 connects to the defined PDOX data source and accesses the COUNTRY table.
******************
If you use JDBC, however, then you will require
*sURL$ = "sdbc:mysql:jdbc:localhost:3306/database_name"*
Be certain to enter the database name. Also, this assumes that you have installed the jdbc connector, and that you have set the classpath inside of OOo to be able to find the class. I have documented how to do this in the 2.0 beta, but I have never done this in 1.1.4.
-- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm Free Info: http://www.pitonyak.org/oo.php
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
