<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ottoshmidt</id>
	<title>Apache OpenOffice Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openoffice.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ottoshmidt"/>
	<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/wiki/Special:Contributions/Ottoshmidt"/>
	<updated>2026-06-17T21:44:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.14</generator>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Working_With_Forms&amp;diff=185006</id>
		<title>Documentation/BASIC Guide/Working With Forms</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Working_With_Forms&amp;diff=185006"/>
		<updated>2010-09-26T10:12:24Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Forms&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Control Element Forms&lt;br /&gt;
|form=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Working with Forms}}&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
{{OOo}} forms may contain text fields, list boxes, radio buttons, and a range of other control elements, which are inserted directly in a text or spreadsheet. The Form Functions Toolbar is used for editing forms.&lt;br /&gt;
&lt;br /&gt;
A {{OOo}} form may adopt one of two modes: the draft mode and the display mode. In draft mode, the position of control elements can be changed and their properties can be edited using a properties window.&lt;br /&gt;
&lt;br /&gt;
The Form Functions Toolbar is also used to switch between modes.&lt;br /&gt;
&lt;br /&gt;
== Determining Object Forms ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} positions the control elements of a form at drawing object level. The actual object form can be accessed through the Forms list at the drawing level. The objects are accessed as follows in text documents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim DrawPage As Object&lt;br /&gt;
Dim Form As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
DrawPage = Doc.DrawPage&lt;br /&gt;
Form = DrawPage.Forms.GetByIndex(0)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;GetByIndex&amp;lt;/tt&amp;gt; method returns the form with the index number 0.&lt;br /&gt;
&lt;br /&gt;
When working with spreadsheets, an intermediate stage is needed for the Sheets list because the drawing levels are not located directly in the document but in the individual sheets:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Sheet As Object&lt;br /&gt;
Dim DrawPage As Object&lt;br /&gt;
Dim Form As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Sheet = Doc.Sheets.GetByIndex(0)&lt;br /&gt;
DrawPage = Sheet.DrawPage&lt;br /&gt;
Form = DrawPage.Forms.GetByIndex(0)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As is already suggested by the &amp;lt;tt&amp;gt;GetByIndex&amp;lt;/tt&amp;gt; method name, a document may contain several forms. This is useful, for example, if the contents of different databases are displayed within one document, or if a 1:n database relationship is displayed within a form. The option of creating sub-forms is also provided for this purpose.&lt;br /&gt;
&lt;br /&gt;
== The Three Aspects of a Control Element Form ==&lt;br /&gt;
&lt;br /&gt;
A control element of a form has three aspects:&lt;br /&gt;
&lt;br /&gt;
* The &amp;#039;&amp;#039;&amp;#039;Model&amp;#039;&amp;#039;&amp;#039; of the control element is the key object for the {{OOo}} Basic-programmer when working with control element forms.&lt;br /&gt;
* The counterpart to this is the &amp;#039;&amp;#039;&amp;#039;View&amp;#039;&amp;#039;&amp;#039; of the control element, which administers the display information.&lt;br /&gt;
* Since control element forms within the documents are administered like a special drawing element, there is also a &amp;#039;&amp;#039;&amp;#039;Shape object&amp;#039;&amp;#039;&amp;#039; which reflects the drawing element-specific properties of the control element (in particular its position and size).&lt;br /&gt;
&lt;br /&gt;
== Accessing the Model of Control Element Forms ==&lt;br /&gt;
&lt;br /&gt;
The models of the control elements of a form are available through the &amp;lt;tt&amp;gt;GetByName&amp;lt;/tt&amp;gt; method of the Object form:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Form As Object&lt;br /&gt;
Dim Ctl As Object&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Form = Doc.DrawPage.Forms.GetByIndex(0)&lt;br /&gt;
Ctl = Form.getByName(&amp;quot;MyListBox&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example determines the model of the &amp;lt;tt&amp;gt;MyListBox&amp;lt;/tt&amp;gt; control element, which is located in the first form of the text document currently open.&lt;br /&gt;
&lt;br /&gt;
If you are not sure of the form of a control element, you can use the option for searching through all forms for the control element required:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Forms As Object&lt;br /&gt;
Dim Form As Object&lt;br /&gt;
Dim Ctl As Object&lt;br /&gt;
Dim I as Integer&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Forms = Doc.Drawpage.Forms&lt;br /&gt;
&lt;br /&gt;
For I = 0 To Forms.Count - 1&lt;br /&gt;
  Form = Forms.GetbyIndex(I)&lt;br /&gt;
  If Form.HasByName(&amp;quot;MyListBox&amp;quot;) Then&lt;br /&gt;
    Ctl = Form.GetbyName(&amp;quot;MyListBox&amp;quot;)&lt;br /&gt;
    Exit For&lt;br /&gt;
  End If&lt;br /&gt;
Next I&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example uses the &amp;lt;tt&amp;gt;HasByName&amp;lt;/tt&amp;gt; method to check all forms of a text document to determine whether they contain a control element model called &amp;lt;tt&amp;gt;MyListBox&amp;lt;/tt&amp;gt;. If a corresponding model is found, then a reference to this is saved in the &amp;lt;tt&amp;gt;Ctl&amp;lt;/tt&amp;gt; variable and the search is terminated.&lt;br /&gt;
&lt;br /&gt;
== Accessing the View of Control Element Forms ==&lt;br /&gt;
&lt;br /&gt;
To access the view of a control element form, you need the associated model. The view of the control element can then be determined with the assistance of the model and using the document controller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim DocCrl As Object&lt;br /&gt;
Dim Forms As Object&lt;br /&gt;
Dim Form As Object&lt;br /&gt;
Dim Ctl As Object&lt;br /&gt;
Dim CtlView As Object&lt;br /&gt;
Dim I as Integer&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
DocCrl = Doc.getCurrentController()&lt;br /&gt;
Forms = Doc.Drawpage.Forms&lt;br /&gt;
&lt;br /&gt;
For I = 0 To Forms.Count - 1&lt;br /&gt;
  Form = Forms.GetbyIndex(I)&lt;br /&gt;
  If Form.HasByName(&amp;quot;MyListBox&amp;quot;) Then&lt;br /&gt;
    Ctl = Form.GetbyName(&amp;quot;MyListBox&amp;quot;)&lt;br /&gt;
    CtlView = DocCrl.GetControl(Ctl)&lt;br /&gt;
    Exit Function&lt;br /&gt;
  End If&lt;br /&gt;
Next I&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code listed in the example is very similar to the code listed in the previous example for determining a control element model. It uses not only the &amp;lt;tt&amp;gt;Doc&amp;lt;/tt&amp;gt; document object but also the &amp;lt;tt&amp;gt;DocCrl&amp;lt;/tt&amp;gt; document controller object which makes reference to the current document window. With the help of this controller object and the model of the control element, it then uses the &amp;lt;tt&amp;gt;GetControl&amp;lt;/tt&amp;gt; method to determine the view (&amp;lt;tt&amp;gt;CtlView&amp;lt;/tt&amp;gt; variable) of the control element form.&lt;br /&gt;
&lt;br /&gt;
== Accessing the Shape Object of Control Element Forms ==&lt;br /&gt;
&lt;br /&gt;
The method for accessing the shape objects of a control element also uses the corresponding drawing level of the document. To determine a special control element, all drawing elements of the drawing level must be searched through.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Shape as Object&lt;br /&gt;
Dim I as integer&lt;br /&gt;
&lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
&lt;br /&gt;
For i = 0 to Doc.DrawPage.Count - 1&lt;br /&gt;
  Shape = Doc.DrawPage(i)&lt;br /&gt;
  If HasUnoInterfaces(Shape, &amp;quot;com.sun.star.drawing.XControlShape&amp;quot;) Then&lt;br /&gt;
    If Shape.Control.Name = &amp;quot;MyListBox&amp;quot; Then&lt;br /&gt;
      Exit Function&lt;br /&gt;
    End If&lt;br /&gt;
  End If&lt;br /&gt;
Next&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The example checks all drawing elements to determine whether they support the &amp;lt;idl&amp;gt;com.sun.star.drawing.XControlShape&amp;lt;/idl&amp;gt; interface needed for control element forms. If this is the case, the &amp;lt;tt&amp;gt;Control.Name&amp;lt;/tt&amp;gt; property then checks whether the name of the control element is &amp;lt;tt&amp;gt;MyListBox&amp;lt;/tt&amp;gt;. If this is true, the function ends the search.&lt;br /&gt;
&lt;br /&gt;
=== Determining the Size and Position of Control Elements ===&lt;br /&gt;
&lt;br /&gt;
As already mentioned, the size and position of control elements can be determined using the associated &amp;lt;tt&amp;gt;shape&amp;lt;/tt&amp;gt; object. The control element shape, like all other &amp;lt;tt&amp;gt;shape&amp;lt;/tt&amp;gt; objects, provides the &amp;lt;tt&amp;gt;Size&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Position&amp;lt;/tt&amp;gt; properties for this purpose:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Size (struct)&amp;lt;/tt&amp;gt;:size of control element (&amp;lt;idl&amp;gt;com.sun.star.awt.Size&amp;lt;/idl&amp;gt; data structure)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Position (struct)&amp;lt;/tt&amp;gt;:position of control element (&amp;lt;idl&amp;gt;com.sun.star.awt.Point&amp;lt;/idl&amp;gt; data structure)&lt;br /&gt;
&lt;br /&gt;
The following example shows how the position and size of a control element can be set using the associated shape object:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim Shape As Object&lt;br /&gt;
Dim Point As New com.sun.star.awt.Point&lt;br /&gt;
Dim Size As New com.sun.star.awt.Size&lt;br /&gt;
&lt;br /&gt;
&amp;#039; ... Initialize Shape object, as previously shown ...&lt;br /&gt;
&lt;br /&gt;
Point.x = 1000&lt;br /&gt;
Point.y = 1000&lt;br /&gt;
Size.Width = 10000&lt;br /&gt;
Size.Height = 10000&lt;br /&gt;
&lt;br /&gt;
Shape.Size = Size&lt;br /&gt;
Shape.Position = Point&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;shape&amp;lt;/tt&amp;gt; object of the control element must already be known if the code is to function. If this is not the case, it must be determined using the preceding code.&lt;br /&gt;
&lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Working With Forms}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Properties&amp;diff=182701</id>
		<title>Documentation/BASIC Guide/Properties</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Properties&amp;diff=182701"/>
		<updated>2010-09-11T13:46:05Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Working With Dialogs&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Events&lt;br /&gt;
|dial=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Properties}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== Name and Title ==&lt;br /&gt;
&lt;br /&gt;
Every control element has its own name that can be queried using the following model property:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Name (String)&amp;lt;/tt&amp;gt;:control element name&lt;br /&gt;
&lt;br /&gt;
You can specify the title that appears in the title bar of a dialog with the following model property:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Title (String)&amp;lt;/tt&amp;gt;:dialog title (only applies to dialogs)&lt;br /&gt;
&lt;br /&gt;
== Position and Size ==&lt;br /&gt;
&lt;br /&gt;
You can query the size and position of a control element using the following properties of the model object:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Height (long)&amp;lt;/tt&amp;gt;:height of control element (in ma units)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Width (long)&amp;lt;/tt&amp;gt;:width of control element (in ma units)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.PositionX (long)&amp;lt;/tt&amp;gt;:X-position of control element, measured from the left inner edge of the dialog (in ma units)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.PositionY (long)&amp;lt;/tt&amp;gt;:Y-position of control element, measured from top inner edge of the dialog (in ma units)&lt;br /&gt;
&lt;br /&gt;
To ensure platform independence for the appearance of dialogs, {{OOo}} uses the &amp;#039;&amp;#039;&amp;#039;Map AppFont (ma)&amp;#039;&amp;#039;&amp;#039; internal unit to specify the position and size within dialogs. An ma unit is defined as being one eighth of the average height of a character from the system font defined in the operating system and one quarter of its width. By using ma units, {{OOo}} ensures that a dialog looks the same on different systems under different system settings.&lt;br /&gt;
&lt;br /&gt;
If you want to change the size or position of control elements for runtime, determine the total size of the dialog and adjust the values for the control elements to the corresponding part ratios.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The Map AppFont (ma) replaces the Twips unit to achieve better platform independence.}}&lt;br /&gt;
&lt;br /&gt;
== Focus and Tabulator Sequence ==&lt;br /&gt;
&lt;br /&gt;
You can navigate through the control elements in any dialog by pressing the Tab key. The following properties are available in this context in the control elements model:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Enabled (Boolean)&amp;lt;/tt&amp;gt;:activates the control element&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Tabstop (Boolean)&amp;lt;/tt&amp;gt;:allows the control element to be reached through the Tab key&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.TabIndex (Long)&amp;lt;/tt&amp;gt;:position of control element in the order of activation&lt;br /&gt;
&lt;br /&gt;
Finally, the control element provides a &amp;lt;tt&amp;gt;setFocus&amp;lt;/tt&amp;gt; method that ensures that the underlying control element receives the focus:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;setFocus&amp;lt;/tt&amp;gt;:control element receives the focus (only for dialogs)&lt;br /&gt;
&lt;br /&gt;
== Multi-Page Dialogs ==&lt;br /&gt;
&lt;br /&gt;
A dialog in {{OOo}} can have more than one tab page. The &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt; property of a dialog defines the current tab page of the dialog whereas the &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt; property for a control element specifies the tab page where the control element is to be displayed.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt;-value of 0 is a special case. If you set this value to zero in a dialog, all of the control elements are visible regardless of their &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt; value. Similarly, if you set this value to zero for a control element, the element is displayed on all of the tab pages in a dialog.&lt;br /&gt;
&lt;br /&gt;
[[Image:documentation_basicguide_dlg_03.gif|none|thumb|500px|Designing Page 1 of the dialog]]&lt;br /&gt;
&lt;br /&gt;
In the preceding example, you can also assign the &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt; value of 0 to the dividing line as well as the &amp;lt;tt&amp;gt;Cancel&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;Prev&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;Next&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;Done&amp;lt;/tt&amp;gt; buttons to display these elements on all pages. You can also assign the elements to an individual tab page (for example page 1).&lt;br /&gt;
&lt;br /&gt;
The following program code shows how the &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt; value in event handlers of the &amp;lt;tt&amp;gt;Next&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Prev&amp;lt;/tt&amp;gt; buttons can be increased or reduced and changes the status of the buttons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Sub cmdNext_Initiated&lt;br /&gt;
&lt;br /&gt;
   Dim cmdNext As Object&lt;br /&gt;
   Dim cmdPrev As Object&lt;br /&gt;
&lt;br /&gt;
   cmdPrev = Dlg.getControl(&amp;quot;cmdPrev&amp;quot;)&lt;br /&gt;
   cmdNext = Dlg.getControl(&amp;quot;cmdNext&amp;quot;)&lt;br /&gt;
   cmdPrev.Model.Enabled = Not cmdPrev.Model.Enabled&lt;br /&gt;
   cmdNext.Model.Enabled = False&lt;br /&gt;
   Dlg.Model.Step = Dlg.Model.Step + 1&lt;br /&gt;
&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub cmdPrev_Initiated&lt;br /&gt;
&lt;br /&gt;
   Dim cmdNext As Object&lt;br /&gt;
   Dim cmdPrev As Object&lt;br /&gt;
&lt;br /&gt;
   cmdPrev = Dlg.getControl(&amp;quot;cmdPrev&amp;quot;)&lt;br /&gt;
   cmdNext = Dlg.getControl(&amp;quot;cmdNext&amp;quot;)&lt;br /&gt;
   cmdPrev.Model.Enabled = False&lt;br /&gt;
   cmdNext.Model.Enabled = True&lt;br /&gt;
   Dlg.Model.Step = Dlg.Model.Step - 1&lt;br /&gt;
&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A global &amp;lt;tt&amp;gt;Dlg&amp;lt;/tt&amp;gt; variable that references an open dialog must be included to make this example possible. The dialog then changes its appearance as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:documentation_basicguide_dlg_05.gif|none|thumb|400px|Page 1]]&lt;br /&gt;
&lt;br /&gt;
[[Image:documentation_basicguide_dlg_06.gif|none|thumb|400px|Page 2]]&lt;br /&gt;
{{Documentation/Tip|You can find an [[Going_further_with_Dialog_and_Component#Multi-Page_Dialog|other OOoBasic example here]].}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Dialogs supporting several languages ==&lt;br /&gt;
&lt;br /&gt;
The strings of a Dialog can be localized, see the Developer&amp;#039;s Guide chapter [[Documentation/DevGuide/Basic/Dialog_Localization|Dialog Localization]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Properties}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Properties&amp;diff=182700</id>
		<title>Documentation/BASIC Guide/Properties</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/BASIC_Guide/Properties&amp;diff=182700"/>
		<updated>2010-09-11T13:45:35Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Documentation/BASICGuideTOC/v2&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=Documentation/BASIC Guide/Working With Dialogs&lt;br /&gt;
|NextPage=Documentation/BASIC Guide/Events&lt;br /&gt;
|dial=block&lt;br /&gt;
}}&lt;br /&gt;
{{DISPLAYTITLE:Properties}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
== Name and Title ==&lt;br /&gt;
&lt;br /&gt;
Every control element has its own name that can be queried using the following model property:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Name (String)&amp;lt;/tt&amp;gt;:control element name&lt;br /&gt;
&lt;br /&gt;
You can specify the title that appears in the title bar of a dialog with the following model property:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Title (String)&amp;lt;/tt&amp;gt;:dialog title (only applies to dialogs)&lt;br /&gt;
&lt;br /&gt;
== Position and Size ==&lt;br /&gt;
&lt;br /&gt;
You can query the size and position of a control element using the following properties of the model object:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Height (long)&amp;lt;/tt&amp;gt;:height of control element (in ma units)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Width (long)&amp;lt;/tt&amp;gt;:width of control element (in ma units)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.PositionX (long)&amp;lt;/tt&amp;gt;:X-position of control element, measured from the left inner edge of the dialog (in ma units)&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.PositionY (long)&amp;lt;/tt&amp;gt;:Y-position of control element, measured from top inner edge of the dialog (in ma units)&lt;br /&gt;
&lt;br /&gt;
To ensure platform independence for the appearance of dialogs, {{OOo}} uses the &amp;#039;&amp;#039;&amp;#039;Map AppFont (ma)&amp;#039;&amp;#039;&amp;#039; internal unit to specify the position and size within dialogs. An ma unit is defined as being one eighth of the average height of a character from the system font defined in the operating system and one quarter of its width. By using ma units, {{OOo}} ensures that a dialog looks the same on different systems under different system settings.&lt;br /&gt;
&lt;br /&gt;
If you want to change the size or position of control elements for runtime, determine the total size of the dialog and adjust the values for the control elements to the corresponding part ratios.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|The Map AppFont (ma) replaces the Twips unit to achieve better platform independence.}}&lt;br /&gt;
&lt;br /&gt;
== Focus and Tabulator Sequence ==&lt;br /&gt;
&lt;br /&gt;
You can navigate through the control elements in any dialog by pressing the Tab key. The following properties are available in this context in the control elements model:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Enabled (Boolean)&amp;lt;/tt&amp;gt;:activates the control element&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.Tabstop (Boolean)&amp;lt;/tt&amp;gt;:allows the control element to be reached through the Tab key&lt;br /&gt;
;&amp;lt;tt&amp;gt;Model.TabIndex (Long)&amp;lt;/tt&amp;gt;:position of control element in the order of activation&lt;br /&gt;
&lt;br /&gt;
Finally, the control element provides a &amp;lt;tt&amp;gt;getFocus&amp;lt;/tt&amp;gt; method that ensures that the underlying control element receives the focus:&lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;setFocus&amp;lt;/tt&amp;gt;:control element receives the focus (only for dialogs)&lt;br /&gt;
&lt;br /&gt;
== Multi-Page Dialogs ==&lt;br /&gt;
&lt;br /&gt;
A dialog in {{OOo}} can have more than one tab page. The &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt; property of a dialog defines the current tab page of the dialog whereas the &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt; property for a control element specifies the tab page where the control element is to be displayed.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt;-value of 0 is a special case. If you set this value to zero in a dialog, all of the control elements are visible regardless of their &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt; value. Similarly, if you set this value to zero for a control element, the element is displayed on all of the tab pages in a dialog.&lt;br /&gt;
&lt;br /&gt;
[[Image:documentation_basicguide_dlg_03.gif|none|thumb|500px|Designing Page 1 of the dialog]]&lt;br /&gt;
&lt;br /&gt;
In the preceding example, you can also assign the &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt; value of 0 to the dividing line as well as the &amp;lt;tt&amp;gt;Cancel&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;Prev&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;Next&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;Done&amp;lt;/tt&amp;gt; buttons to display these elements on all pages. You can also assign the elements to an individual tab page (for example page 1).&lt;br /&gt;
&lt;br /&gt;
The following program code shows how the &amp;lt;tt&amp;gt;Step&amp;lt;/tt&amp;gt; value in event handlers of the &amp;lt;tt&amp;gt;Next&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Prev&amp;lt;/tt&amp;gt; buttons can be increased or reduced and changes the status of the buttons.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Sub cmdNext_Initiated&lt;br /&gt;
&lt;br /&gt;
   Dim cmdNext As Object&lt;br /&gt;
   Dim cmdPrev As Object&lt;br /&gt;
&lt;br /&gt;
   cmdPrev = Dlg.getControl(&amp;quot;cmdPrev&amp;quot;)&lt;br /&gt;
   cmdNext = Dlg.getControl(&amp;quot;cmdNext&amp;quot;)&lt;br /&gt;
   cmdPrev.Model.Enabled = Not cmdPrev.Model.Enabled&lt;br /&gt;
   cmdNext.Model.Enabled = False&lt;br /&gt;
   Dlg.Model.Step = Dlg.Model.Step + 1&lt;br /&gt;
&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Sub cmdPrev_Initiated&lt;br /&gt;
&lt;br /&gt;
   Dim cmdNext As Object&lt;br /&gt;
   Dim cmdPrev As Object&lt;br /&gt;
&lt;br /&gt;
   cmdPrev = Dlg.getControl(&amp;quot;cmdPrev&amp;quot;)&lt;br /&gt;
   cmdNext = Dlg.getControl(&amp;quot;cmdNext&amp;quot;)&lt;br /&gt;
   cmdPrev.Model.Enabled = False&lt;br /&gt;
   cmdNext.Model.Enabled = True&lt;br /&gt;
   Dlg.Model.Step = Dlg.Model.Step - 1&lt;br /&gt;
&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A global &amp;lt;tt&amp;gt;Dlg&amp;lt;/tt&amp;gt; variable that references an open dialog must be included to make this example possible. The dialog then changes its appearance as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:documentation_basicguide_dlg_05.gif|none|thumb|400px|Page 1]]&lt;br /&gt;
&lt;br /&gt;
[[Image:documentation_basicguide_dlg_06.gif|none|thumb|400px|Page 2]]&lt;br /&gt;
{{Documentation/Tip|You can find an [[Going_further_with_Dialog_and_Component#Multi-Page_Dialog|other OOoBasic example here]].}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Dialogs supporting several languages ==&lt;br /&gt;
&lt;br /&gt;
The strings of a Dialog can be localized, see the Developer&amp;#039;s Guide chapter [[Documentation/DevGuide/Basic/Dialog_Localization|Dialog Localization]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{InterWiki Languages BasicGuide|articletitle=Documentation/BASIC Guide/Properties}}&lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Talk:Documentation/BASIC_Guide/Properties&amp;diff=182699</id>
		<title>Talk:Documentation/BASIC Guide/Properties</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Talk:Documentation/BASIC_Guide/Properties&amp;diff=182699"/>
		<updated>2010-09-11T13:45:10Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: Created page with &amp;#039;&amp;#039;&amp;#039;getfocus&amp;#039;&amp;#039; method gives error and &amp;#039;&amp;#039;setfocus&amp;#039;&amp;#039; works. So I changed it --~~~~&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;getfocus&amp;#039;&amp;#039; method gives error and &amp;#039;&amp;#039;setfocus&amp;#039;&amp;#039; works. So I changed it --[[User:Ottoshmidt|Ottoshmidt]] 13:45, 11 September 2010 (UTC)&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Documentation/How_Tos/Using_SQLite_With_OpenOffice.org&amp;diff=181944</id>
		<title>Documentation/How Tos/Using SQLite With OpenOffice.org</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Documentation/How_Tos/Using_SQLite_With_OpenOffice.org&amp;diff=181944"/>
		<updated>2010-09-03T16:51:33Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
OpenOffice Base provides functions to connect to other databases than the default HSQL database. This Tutorial should guide you through the steps to connect OpenOffice to a [http://www.sqlite.org/ SQLite] database file.&lt;br /&gt;
&lt;br /&gt;
==What is SQLite?==&lt;br /&gt;
&lt;br /&gt;
[http://www.sqlite.org/ SQLite] is a basic database engine that implements most of the features of SQL92. &lt;br /&gt;
Unlike PostgreSQL and MySQL, SQLite stores a whole data base with all its tables a single file. Other &lt;br /&gt;
benefits are: database access requires no database server, database files can be freely shared between &lt;br /&gt;
machines with different byte orders and databases can be up to 2 terabytes (2&amp;lt;sup&amp;gt;41&amp;lt;/sup&amp;gt; bytes) in size. &lt;br /&gt;
Plus it is fast (twice as much as PostgreSQL and MySQL for most operations) and has a small memory footprint.&lt;br /&gt;
&lt;br /&gt;
Data management can be achieved in the following ways:  &lt;br /&gt;
# Via a C/C++ Linux library or Windows DLL.&lt;br /&gt;
# Via an in-line program (sqlite: available under Linux and Windows) that makes it possible to create and to manage the files of data bases.  &lt;br /&gt;
# Via the SQLite PHP module or, if you have, PHP version 5 internally to a SQLite database.  &lt;br /&gt;
# Via ODBC (Linux and Windows) which allows any application supporting this standard to reach a SQLite database.&lt;br /&gt;
# Using the [http://dba.openoffice.org/drivers/sqlite/index.html experimental SDBC SQLite driver]&lt;br /&gt;
&lt;br /&gt;
This guide addresses ODBC which OpenOffice.org uses to attach to databases and SQLite, in particular.&lt;br /&gt;
&lt;br /&gt;
==Why use SQLite with OpenOffice.org?==&lt;br /&gt;
&lt;br /&gt;
The use of SQLite has many advantages:  &lt;br /&gt;
&lt;br /&gt;
* The data base is in only one file, in contrast to dBASE which creates a file per table, making it easy to exchange databases between various users.&lt;br /&gt;
* Java JRE or SDK is not required to support SQLite.&lt;br /&gt;
* No server is needed (local or remote) to access a database.&lt;br /&gt;
* ODBC drivers exist for *NIX and for Windows, thus enabling users of both environments to access data and exchange them.&lt;br /&gt;
* A [http://dba.openoffice.org/drivers/sqlite/index.html new SDBC driver] (native to OpenOffice.org) is available for experimentation.&lt;br /&gt;
* Sophisticated graphic interfaces, such as those of msaccess, can be easily developed using the forms, queries, states and macros of OpenOffice.org. These interfaces are stored separately in OpenOffice .odb files and can be exchanged independent from the data between users under UNIX or Windows.&lt;br /&gt;
&lt;br /&gt;
and some disadvantages:&lt;br /&gt;
&lt;br /&gt;
* Modifying the structure of a SQLite table after its creation is not directly possible. This means that you cannot easily add fields nor to modify their properties once that the table is created.  Therefore you must prepare the structure of your tables before creating them.&lt;br /&gt;
* OpenOffice.org requires the use of the ODBC driver for accessing a SQLite database thus making this operation somewhat complicated. First it must be declared in ODBC and then in OpenOffice.org. The native SDBC driver should correct this situation when it is production ready. &lt;br /&gt;
* The initial database file cannot be created with OpenOffice.org but by using other tools.  &lt;br /&gt;
&lt;br /&gt;
In short, the principal advantages of the use of SQLite with OpenOffice.org are the format of data storage and the portability from one environment to another.  In the list of disadvantages, the two last are not specific to SQLite, but are requirements of using ODBC.  However, these are not as awkward as they do not take place during the initial creation of the database.  &lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|SQLite appeals to anyone frustrated with using MDB files under Linux, or who has had difficulty installing MySQL or other RDBMS server on their workstation.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Installation=&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Linux|&amp;#039;&amp;#039;&amp;#039;Under Linux&amp;#039;&amp;#039;&amp;#039;}}&lt;br /&gt;
==ODBC drivers==&lt;br /&gt;
Connection to a SQLite database will be established through ODBC drivers. ODBC drivers for SQLite are independent of the SQLite project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can install &amp;lt;tt&amp;gt;unixodbc&amp;lt;/tt&amp;gt; with your packetmanager - or download the sources from the [http://www.unixodbc.org/ unixODBC] website. The &amp;lt;tt&amp;gt;unixodbc-dev&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;unixodbc-bin&amp;lt;/tt&amp;gt; packages will also be required to complete the configuration for OpenOffice.&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get unixodbc unixodbc-dev unixodbc-bin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==SQLite==&lt;br /&gt;
Obviously you will need to install [http://www.sqlite.org SQLite] if it is not installed already as this will be the database you want to connect to. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There will likely be a version in the repositories although it might be dated. You can always [http://www.sqlite.org/download.html download] and install the latest version from source.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==sqliteODBC==&lt;br /&gt;
For SQLite to work through the ODBC standards you will also need to install and configure a special set of drivers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are no precompiled packages so you will need to [http://ch-werner.de/sqliteodbc/ download the source] and compile it yourself:&lt;br /&gt;
&lt;br /&gt;
 tar xvzf sqliteodbc-0.&amp;#039;&amp;#039;XX&amp;#039;&amp;#039;.tar.gz&lt;br /&gt;
 ./configure –prefix=/usr&lt;br /&gt;
 make&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;--prefix=/usr&amp;lt;/tt&amp;gt; is optional, but is especially useful with Mandrake distributions, to install the driver in &amp;lt;tt&amp;gt;/usr/lib&amp;lt;/tt&amp;gt; rather than in the default location, &amp;lt;tt&amp;gt;/usr/local/lib&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|If you get an error message claiming &amp;#039;&amp;#039;&amp;quot;ODBC header files and/or libraries not found&amp;quot;&amp;#039;&amp;#039; check that you have installed the &amp;lt;tt&amp;gt;unixODBC-dev&amp;lt;/tt&amp;gt; package while installing the [[#ODBC_drivers|ODBC drivers]].}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To complete the installation the driver has to be integrated into unixODBC. To do this, launch the ODBCConfig utility as root in an terminal window:&lt;br /&gt;
&lt;br /&gt;
 sudo ODBCConfig&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|If ODBCConfig is not found check that you also installed the &amp;lt;tt&amp;gt;unixODBC-bin&amp;lt;/tt&amp;gt; package while installing the [[#ODBC_drivers|ODBC drivers]].}}&lt;br /&gt;
&lt;br /&gt;
Now the a GUI to manage the configuration shows up.&lt;br /&gt;
[[Image:doc_howto_sqlite_odbcadmin.png|390px]]&lt;br /&gt;
&lt;br /&gt;
Click the &amp;lt;tt&amp;gt;Drivers&amp;lt;/tt&amp;gt; tab and choose &amp;lt;tt&amp;gt;Add...&amp;lt;/tt&amp;gt; Then fill the fields as follows:&lt;br /&gt;
&lt;br /&gt;
 Name: SQLite&lt;br /&gt;
 Description: SQLite for ODBC&lt;br /&gt;
 Driver: /usr/lib/libsqlite3odbc.so&lt;br /&gt;
 Driver64:&lt;br /&gt;
 Setup: /usr/lib/libsqlite3odbc.so&lt;br /&gt;
 Setup64:&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|If you are still using a 2.8.x version of libsqlite the driver names will be different. Try browsing the folder by clicking on the arrow at the right and select one that seems suitable.}}&lt;br /&gt;
&lt;br /&gt;
Then confirm using the checkmark icon on the left in top of the window. Your new driver will now appear in the &amp;lt;tt&amp;gt;Drivers&amp;lt;/tt&amp;gt; tab:&lt;br /&gt;
[[Image:doc_howto_sqlite_odbcadmin-2.png|450px]]&lt;br /&gt;
&lt;br /&gt;
The driver installation under Linux is now finished and you can exit &amp;lt;tt&amp;gt;ODBCConfig&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For those who do not have &amp;lt;tt&amp;gt;ODBCConfig&amp;lt;/tt&amp;gt; or who prefer to carry out this configuration manually, it is necessary to edit the file &amp;lt;tt&amp;gt;/etc/odbcinst.ini&amp;lt;/tt&amp;gt; as root and add the following lines:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;[SQLite]&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&lt;br /&gt;
 Description&amp;lt;nowiki&amp;gt;= ODBC for SQLite&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&lt;br /&gt;
 Driver&amp;lt;nowiki&amp;gt;= /usr/lib/libsqliteODBC.so&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&lt;br /&gt;
 Setup&amp;lt;nowiki&amp;gt;= /usr/lib/libsqliteODBC.so&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&lt;br /&gt;
 FileUsage&amp;lt;nowiki&amp;gt;= 1&amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&lt;br /&gt;
 CPTimeout&amp;lt;nowiki&amp;gt;= &amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&lt;br /&gt;
 CPReuse&amp;lt;nowiki&amp;gt;= &amp;lt;/nowiki&amp;gt;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Under Windows==&lt;br /&gt;
{{Documentation/Windows|Under Windows the installation and configuration is much easier. Simply [http://ch-werner.de/sqliteodbc/ download the sqliteODBC.exe], the installer will automatically setup the ODBC drivers including the SQLite configurations for it and also provides you with the sqlite command line tool to create and modify SQLite databases.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Setup of SQLite database=&lt;br /&gt;
&lt;br /&gt;
==Creating a SQLite database file==&lt;br /&gt;
An initial database file cannot be created directly in OpenOffice.org but rather this is accomplished by using either the utility “&amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt;” on the command line or by using a graphical management tool, a list of GUIs is available at [http://www.sqlite.org/cvstrac/wiki?p=ManagementTools SQLite.org]&lt;br /&gt;
&lt;br /&gt;
The utility &amp;quot;&amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt;&amp;quot; should be already installed if you use Linux and have installed SQLite from rpm. For other *NIX systems, you must build SQLite from source which you can find at [http://www.sqlite.org/download.html]&lt;br /&gt;
&lt;br /&gt;
Performance and usage under Linux and Windows is identical.&lt;br /&gt;
 &lt;br /&gt;
===Using sqlite===&lt;br /&gt;
{{Documentation/Linux|Open a terminal window and change to the directory where you want to create your database. Run &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; with the filename of your database as argument (e.g. &amp;#039;&amp;#039;$ sqlite mydatabase&amp;#039;&amp;#039;}}&lt;br /&gt;
{{Documentation/Windows|Run &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; from the start menu or where it was installed. A standard file open dialog box will open and ask you to select a database file.}}&lt;br /&gt;
If this database file does not exist yet it will be created automatically. Using &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; you can also create tables and modify your database with standard SQL-commands:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;$ sqlite &amp;lt;filename of database&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 SQLite version 2.8.12&lt;br /&gt;
 Enter &amp;quot;.help&amp;quot; for instructions&lt;br /&gt;
 sqlite&amp;gt; CREATE TABLE mytable (id INT, text VARCHAR(100));&lt;br /&gt;
 sqlite&amp;gt; .exit&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|You can then check that the file was, indeed, created in your filesystem. The name of the file does not require a file extension, but you can give it the extension &amp;lt;tt&amp;gt;db&amp;lt;/tt&amp;gt; so that is easy to locate as a database.}}&lt;br /&gt;
&lt;br /&gt;
Using &amp;lt;tt&amp;gt;sqlite&amp;lt;/tt&amp;gt; on the command line program makes it possible to create tables and indices, to enter and post data and &lt;br /&gt;
to make queries provided you know the SQL language - however, it is more practical for beginners to carry out these operations later on using&lt;br /&gt;
OpenOffice.&lt;br /&gt;
&lt;br /&gt;
===Using SQLite Database Browser===&lt;br /&gt;
{{Documentation/Caution|This information might be outdated.}}&lt;br /&gt;
&lt;br /&gt;
After unpacking the file, launch &amp;lt;tt&amp;gt;sqlitebrowser&amp;lt;/tt&amp;gt; and select &amp;lt;tt&amp;gt;File/New Database&amp;lt;/tt&amp;gt; or the corresponding icon:&lt;br /&gt;
&lt;br /&gt;
[[Image:doc_howto_sqlite_dbbrowser.png|410px]]&lt;br /&gt;
&lt;br /&gt;
Choose the directory in which to place file and then enter name of the database file and click on &amp;lt;tt&amp;gt;Save&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Using this program, you can also create the tables, the fields and the indices, to access data and to visualize them. While&lt;br /&gt;
&amp;lt;tt&amp;gt;sqlitebrowswer&amp;lt;/tt&amp;gt; is suitable for these actions, there is the disadvantage that it does not show the full list of field types during&lt;br /&gt;
field creation. In this case, it may be preferable to do it later using OpenOffice.org.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==ODBC-setup of new database==&lt;br /&gt;
After creating a new SQLite database above you now have to configure this database in ODBC so you can connect to it in OpenOffice later on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Linux|&amp;#039;&amp;#039;&amp;#039;Under Linux:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Launch &amp;lt;tt&amp;gt;ODBCConfig&amp;lt;/tt&amp;gt; again as normal user and go to the tab &amp;lt;tt&amp;gt;User DSN&amp;lt;/tt&amp;gt;. Here add a new entry. A window appears in which you must choose &lt;br /&gt;
the &amp;lt;tt&amp;gt;SQLite&amp;lt;/tt&amp;gt; driver you have configured earlier. In the next window, as shown below, you enter a name for this connection (for example the name of your database) and the complete access path to the database file which you created previously.&lt;br /&gt;
&lt;br /&gt;
[[Image:doc_howto_sqlite_driverproperties-2.png|380px]]&lt;br /&gt;
&lt;br /&gt;
Validate the data on the screen, click the checkmark and you should see your new data source in the tab &amp;lt;tt&amp;gt;User DSN&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you do not have &amp;lt;tt&amp;gt;ODBCConfig&amp;lt;/tt&amp;gt; or simply prefer to configure manually, launch your favorite editor, open (or create) &lt;br /&gt;
the file &amp;lt;tt&amp;gt;odbc.ini&amp;lt;/tt&amp;gt; in your home directory, and add the following lines to it:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;[My Base]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 Description&amp;lt;nowiki&amp;gt;= My test database&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 Driver&amp;lt;nowiki&amp;gt;= SQLite&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 Database&amp;lt;nowiki&amp;gt;= /home/&amp;lt;user&amp;gt;/basename.db&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 Timeout&amp;lt;nowiki&amp;gt;= 1000&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 StepAPI&amp;lt;nowiki&amp;gt;= No&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Note|If this data source must by other users on the system, launch &amp;lt;tt&amp;gt;ODBCConfig&amp;lt;/tt&amp;gt; as root and add this source in the tab &amp;lt;tt&amp;gt;System DSN&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;data Source system&amp;lt;/tt&amp;gt;, or create a &amp;lt;tt&amp;gt;/etc/odbc.ini&amp;lt;/tt&amp;gt; file.}}&lt;br /&gt;
&lt;br /&gt;
You are now ready to access your data base with OpenOffice.org!}}&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Windows|&amp;#039;&amp;#039;&amp;#039;Under Windows:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
You will reach the configuration through the OpenOffice dialog in the next step, just read on.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Connecting OpenOffice to a SQLite database=&lt;br /&gt;
You had to spend a lot of time installing and configuring other things but finally we can move on to OpenOffice. Only a few more configuration windows and you will be done.&lt;br /&gt;
&lt;br /&gt;
Start &amp;#039;&amp;#039;OpenOffice Base&amp;#039;&amp;#039; and in the first step &amp;#039;&amp;#039;&amp;#039;1. Select database&amp;#039;&amp;#039;&amp;#039; chose the third option, connect to an existing database using ODBC.&lt;br /&gt;
&lt;br /&gt;
 Connect to an existing database&lt;br /&gt;
  ODBC&lt;br /&gt;
&lt;br /&gt;
In the second step &amp;#039;&amp;#039;&amp;#039;2. Set up ODBC connection&amp;#039;&amp;#039;&amp;#039; you can select your SQLite database. Clicking on &amp;#039;&amp;#039;Browse&amp;#039;&amp;#039; you should get a list of all databases you have [[#ODBC-setup of new database|configured]] in ODBC.&lt;br /&gt;
&lt;br /&gt;
If nothing is showing up here you have a problem. Check that you actually [[#ODBC-setup of new database|set up the database in ODBC]] and that the drivers are properly configured as described.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Windows|&amp;#039;&amp;#039;&amp;#039;Under Windows:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Before you will find your database listed here you need to register it with ODBC as mentioned above. Click on &amp;#039;&amp;#039;Organize...&amp;#039;&amp;#039; in the bottom right of the window.&lt;br /&gt;
&lt;br /&gt;
[[Image:doc_howto_sqlite_odbcdriver-windows-1.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the &amp;#039;&amp;#039;User DSN&amp;#039;&amp;#039; (or the &amp;#039;&amp;#039;System DSN&amp;#039;&amp;#039;) tab click on &amp;#039;&amp;#039;Add...&amp;#039;&amp;#039; to setup your database file.&lt;br /&gt;
&lt;br /&gt;
[[Image:doc_howto_sqlite_odbcdriver-windows-2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Give your database a meaningful name as &amp;#039;&amp;#039;Data Source Name&amp;#039;&amp;#039; - this will be the name you find your database listed as. For &amp;#039;&amp;#039;Database Name&amp;#039;&amp;#039; browse to the SQLite database file you have created earlier. Leave the rest on its default values and press ok. &lt;br /&gt;
&lt;br /&gt;
[[Image:doc_howto_sqlite_odbcdriver-windows-3.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The database will now be listed in the &amp;#039;&amp;#039;ODBC Data Source Administrator&amp;#039;&amp;#039; and leaving this window you should now also be able to select this database in the &amp;#039;&amp;#039;OpenOffice Base&amp;#039;&amp;#039; dialog.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Working on the database with OpenOffice=&lt;br /&gt;
The rest is &amp;#039;&amp;#039;OpenOffice Base&amp;#039;&amp;#039; just as you know it.&lt;br /&gt;
&lt;br /&gt;
Only note a few things:&lt;br /&gt;
Creating new tables using OpenOffice is possible. Those tables - along with all data you enter in them - are saved in the external SQLite database file to which you connected your OpenOffice .odb file.&lt;br /&gt;
&lt;br /&gt;
Fields defined as type &amp;quot;integer&amp;quot; are auto-increment, that is they automatically increment the value of the field when adding a new record in this table.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|Once you have saved your table, you cannot modify it! I.e. you will not be able to modify the properties of the fields any more, nor add or remove!}}&lt;br /&gt;
&lt;br /&gt;
This rather awkward constraint is specific to SQLite, which does not handle the SQL command ALTER COUNTS, and not the ODBC driver. This limitation is designed in by the authors in order to make the basic database engine as light as possible. However, this limitation may be eliminated in a future version. Therefore you are advised to check your table structure very carefully before recording it.&lt;br /&gt;
&lt;br /&gt;
If you must modify a table, the only solution is to create a new table and save it under different name. By doing do, you can transfer the data from the original table to the new table. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Creating and using Forms, Queries and Reports are all independent of the datasource you use. They will function just as with the default integrated HSQL-database and will still be saved in your odb-file. For more information on these topics refer to the [[Base|other documentation]].&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|If you want to use subforms you need to activate &amp;quot;parameter substitution&amp;quot; first.&lt;br /&gt;
Select &amp;quot;Edit/Database/Advanced Settings...&amp;quot; in the main menu of your OpenOffice Base window. There, in the &amp;quot;Special Settings&amp;quot; tab check the option &amp;quot;Replace named parameters with &amp;#039;?&amp;#039;&amp;quot;. You might need to restart OpenOffice but then you should be able to use subforms without problems.}}&lt;br /&gt;
&lt;br /&gt;
=Exchanging databases between users=&lt;br /&gt;
&lt;br /&gt;
Thanks to the availability of driver sqliteODBC driver for both Linux and Windows (just as for OpenOffice.org, of course!), a SQLite&lt;br /&gt;
database SQLite can be easily exchanged between users of the two environments. It is necessary that each has an installed &lt;br /&gt;
ODBC driver that is aware of the target SQLite file and which is defined as a data source in OpenOffice.org. Likewise OpenOffice Base files (.odb) containing forms and macros can also be exchanged between users of the two environments.&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|If forms are to function correctly for each user, it is absolutely necessary that each user applies exactly the same name to the data source during its creation.}}&lt;br /&gt;
&lt;br /&gt;
{{PDL1}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:Documentation/How Tos/Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Talk:Documentation/BASIC_Guide/Control_Element_Forms&amp;diff=161576</id>
		<title>Talk:Documentation/BASIC Guide/Control Element Forms</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Talk:Documentation/BASIC_Guide/Control_Element_Forms&amp;diff=161576"/>
		<updated>2010-03-30T07:24:31Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Option Button grouping method ==&lt;br /&gt;
&lt;br /&gt;
The code described in this article used to group Option Buttons returns an error:&lt;br /&gt;
&lt;br /&gt;
[[File:Lens_diff.png‎]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this error is caused by the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
    Ctl = Form. GetGroupbyName(&amp;quot;MyOptions&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However I found this method that works fine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Function test&lt;br /&gt;
Dim oGroup as object&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Forms As Object&lt;br /&gt;
Dim Form As Object&lt;br /&gt;
Dim Ctl As Object&lt;br /&gt;
Dim I as Integer&lt;br /&gt;
 &lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Forms = Doc.Drawpage.Forms&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
  Form = Forms.GetbyIndex(0)&lt;br /&gt;
&lt;br /&gt;
     oForm.getGroupByName(&amp;quot;MyOptions&amp;quot;, oGroup)&lt;br /&gt;
   msg=&amp;quot;&amp;quot;&lt;br /&gt;
   for i=0 to UBound(oGroup)&lt;br /&gt;
       oCtl = oGroup(i)&lt;br /&gt;
       msg = msg + oCtl.Name + &amp;quot; &amp;quot; + (str(oCtl.State)) + chr(10)&lt;br /&gt;
   next i&lt;br /&gt;
   MsgBox msg &lt;br /&gt;
&lt;br /&gt;
end Function  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See: [http://www.oooforum.org/forum/viewtopic.phtml?t=28446] and [http://user.services.openoffice.org/en/forum/viewtopic.php?f=20&amp;amp;t=12517]&lt;br /&gt;
&lt;br /&gt;
--[[User:Ottoshmidt|Ottoshmidt]] 07:24, 30 March 2010 (UTC)&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Talk:Documentation/BASIC_Guide/Control_Element_Forms&amp;diff=161575</id>
		<title>Talk:Documentation/BASIC Guide/Control Element Forms</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Talk:Documentation/BASIC_Guide/Control_Element_Forms&amp;diff=161575"/>
		<updated>2010-03-30T07:24:02Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: Created page with &amp;#039;== Option Button grouping method ==  The code described in this article used to group Option Buttons returns an error:  File:Lens_diff.png‎   this error is caused by the fo…&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Option Button grouping method ==&lt;br /&gt;
&lt;br /&gt;
The code described in this article used to group Option Buttons returns an error:&lt;br /&gt;
&lt;br /&gt;
[[File:Lens_diff.png‎]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
this error is caused by the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
    Ctl = Form. GetGroupbyName(&amp;quot;MyOptions&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However I found this method that works fine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Function test&lt;br /&gt;
Dim oGroup as object&lt;br /&gt;
Dim Doc As Object&lt;br /&gt;
Dim Forms As Object&lt;br /&gt;
Dim Form As Object&lt;br /&gt;
Dim Ctl As Object&lt;br /&gt;
Dim I as Integer&lt;br /&gt;
 &lt;br /&gt;
Doc = ThisComponent&lt;br /&gt;
Forms = Doc.Drawpage.Forms&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
  Form = Forms.GetbyIndex(0)&lt;br /&gt;
&lt;br /&gt;
     oForm.getGroupByName(&amp;quot;MyOptions&amp;quot;, oGroup)&lt;br /&gt;
   msg=&amp;quot;&amp;quot;&lt;br /&gt;
   for i=0 to UBound(oGroup)&lt;br /&gt;
       oCtl = oGroup(i)&lt;br /&gt;
       msg = msg + oCtl.Name + &amp;quot; &amp;quot; + (str(oCtl.State)) + chr(10)&lt;br /&gt;
   next i&lt;br /&gt;
   MsgBox msg &lt;br /&gt;
&lt;br /&gt;
end Function  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See: [http://www.oooforum.org/forum/viewtopic.phtml?t=28446] and [http://user.services.openoffice.org/en/forum/viewtopic.php?f=20&amp;amp;t=12517]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=File:Lens_diff.png&amp;diff=161574</id>
		<title>File:Lens diff.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=File:Lens_diff.png&amp;diff=161574"/>
		<updated>2010-03-30T07:17:07Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: error message box&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;error message box&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=160547</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=160547"/>
		<updated>2010-03-26T14:19:48Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Debian/Ubuntu */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
Obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website] and install it on your system. Then:&lt;br /&gt;
&lt;br /&gt;
1) Navigate to Control Panel &amp;gt; Administrative Tools and double-click on Data Sources (ODBC)&lt;br /&gt;
&lt;br /&gt;
2) on the User DSN tab Click Add button and from the list of available drivers, select the MySQL ODBC Driver, and click OK.&lt;br /&gt;
&lt;br /&gt;
3) Input requires data in the appeared dialog:&lt;br /&gt;
&lt;br /&gt;
Data Source Name: it&amp;#039;s optional. Let it be &amp;quot;Mysql-test&amp;quot; in our case.&lt;br /&gt;
&lt;br /&gt;
Description: is optional as well.&lt;br /&gt;
&lt;br /&gt;
Server: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (in case mysql server is installed on the local machine, or IP Address if it&amp;#039;s on network machine)&lt;br /&gt;
&lt;br /&gt;
fill out user and password fields respectively. You should be able to see mysql databases under Database drop-down list, choose one. Click OK.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click Browse and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed) or obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website].&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and/etc/odbc.ini should have (or create ~/.odbc.ini so that you can modify it as normal user):&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
In above configuration we assumed that database named &amp;quot;test&amp;quot; exists on local server. Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on OS X ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
1) Download MySQL Connector/J from [http://www.mysql.com/downloads/ MySQL Downloads]&lt;br /&gt;
&lt;br /&gt;
Choose &amp;#039;&amp;#039;&amp;#039;Platform independent&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
Choose &amp;#039;&amp;#039;&amp;#039;Zip File&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;Tar File&amp;#039;&amp;#039;&amp;#039; (either will do)&lt;br /&gt;
&lt;br /&gt;
2) Double click file to extract&lt;br /&gt;
&lt;br /&gt;
3) Make a directory under your user name (I use a combination of connectorj and the version number.)&lt;br /&gt;
&lt;br /&gt;
4) Copy the contents of the zip file into this new directory.&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
Set up OpenOffice.org for use via JDBC (Warning! This will require a restart of OpenOffice.org!):&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org &amp;gt; Perferences &amp;gt; Java&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;CLASSPATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Add Archive&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Browse to the jar file from the zip/tar file (mysql-connector-java-x.x.x-bin.jar where x.x.x is the version number).&lt;br /&gt;
&lt;br /&gt;
Click OK.  OpenOffice.org will warn a restart of the application is required.&lt;br /&gt;
&lt;br /&gt;
=== Setting up a database for use ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;These instructions assume the use of an existing database.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and choose a file type of &amp;quot;Database.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Click the radio button &amp;quot;Connect to an existing database&amp;quot; with the drop down set to JDBC.&lt;br /&gt;
&lt;br /&gt;
Click Next.&lt;br /&gt;
&lt;br /&gt;
In the URL following jdbc: fill in with the proper settings in the format mysql://servername:port/databasename (if default port, you can ignore the port portion.)&lt;br /&gt;
&lt;br /&gt;
Fill in the Driver Class with &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; and click &amp;quot;Test Class.&amp;quot;  You should see a message &amp;quot;The JDBC driver was loaded successfully.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Click Next.&lt;br /&gt;
&lt;br /&gt;
Enter the user name to connect to the DB with.  If a password is required, check the &amp;quot;Password required&amp;quot; box.&lt;br /&gt;
&lt;br /&gt;
Click &amp;quot;Test Connection&amp;quot; and it should prompt with the user name and a password prompt.  You should see a pop-up saying &amp;quot;The connection was established successfully.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Click Next.&lt;br /&gt;
&lt;br /&gt;
Best to leave the defaults on this next screen set.&lt;br /&gt;
&lt;br /&gt;
Click Finish.&lt;br /&gt;
&lt;br /&gt;
You will be prompted on where to put the database configurations for use with OpenOffice.org.  (I usually make a small directory in my Documents folder.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155742</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155742"/>
		<updated>2010-01-26T19:18:39Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Debian/Ubuntu */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
Obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website] and install it on your system. Then:&lt;br /&gt;
&lt;br /&gt;
1) Navigate to Control Panel &amp;gt; Administrative Tools and double-click on Data Sources (ODBC)&lt;br /&gt;
&lt;br /&gt;
2) on the User DSN tab Click Add button and from the list of available drivers, select the MySQL ODBC Driver, and click OK.&lt;br /&gt;
&lt;br /&gt;
3) Input requires data in the appeared dialog:&lt;br /&gt;
&lt;br /&gt;
Data Source Name: it&amp;#039;s optional. Let it be &amp;quot;Mysql-test&amp;quot; in our case.&lt;br /&gt;
&lt;br /&gt;
Description: is optional as well.&lt;br /&gt;
&lt;br /&gt;
Server: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (in case mysql server is installed on the local machine, or IP Address if it&amp;#039;s on network machine)&lt;br /&gt;
&lt;br /&gt;
fill out user and password fields respectively. You should be able to see mysql databases under Database drop-down list, choose one. Click OK.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click Browse and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed) or obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website].&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and/etc/odbc.ini should have (or create ~/.odbc.ini so that you can modify it as normal user):&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
In above configuration we assumed that database named &amp;quot;test&amp;quot; exists on mysql-server. Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155461</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155461"/>
		<updated>2010-01-22T14:31:46Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Debian/Ubuntu */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
Obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website] and install it on your system. Then:&lt;br /&gt;
&lt;br /&gt;
1) Navigate to Control Panel &amp;gt; Administrative Tools and double-click on Data Sources (ODBC)&lt;br /&gt;
&lt;br /&gt;
2) on the User DSN tab Click Add button and from the list of available drivers, select the MySQL ODBC Driver, and click OK.&lt;br /&gt;
&lt;br /&gt;
3) Input requires data in the appeared dialog:&lt;br /&gt;
&lt;br /&gt;
Data Source Name: it&amp;#039;s optional. Let it be &amp;quot;Mysql-test&amp;quot; in our case.&lt;br /&gt;
&lt;br /&gt;
Description: is optional as well.&lt;br /&gt;
&lt;br /&gt;
Server: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (in case mysql server is installed on the local machine, or IP Address if it&amp;#039;s on network machine)&lt;br /&gt;
&lt;br /&gt;
fill out user and password fields respectively. You should be able to see mysql databases under Database drop-down list, choose one. Click OK.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click Browse and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed) or obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website].&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and /etc/odbc.ini should have (or create ~/odbc.ini so that you can modify it as normal user):&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155460</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155460"/>
		<updated>2010-01-22T14:31:28Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Debian/Ubuntu */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
Obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website] and install it on your system. Then:&lt;br /&gt;
&lt;br /&gt;
1) Navigate to Control Panel &amp;gt; Administrative Tools and double-click on Data Sources (ODBC)&lt;br /&gt;
&lt;br /&gt;
2) on the User DSN tab Click Add button and from the list of available drivers, select the MySQL ODBC Driver, and click OK.&lt;br /&gt;
&lt;br /&gt;
3) Input requires data in the appeared dialog:&lt;br /&gt;
&lt;br /&gt;
Data Source Name: it&amp;#039;s optional. Let it be &amp;quot;Mysql-test&amp;quot; in our case.&lt;br /&gt;
&lt;br /&gt;
Description: is optional as well.&lt;br /&gt;
&lt;br /&gt;
Server: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (in case mysql server is installed on the local machine, or IP Address if it&amp;#039;s on network machine)&lt;br /&gt;
&lt;br /&gt;
fill out user and password fields respectively. You should be able to see mysql databases under Database drop-down list, choose one. Click OK.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click Browse and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed) or obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website].&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and /etc/odbc.ini should have (or create ~/etc/odbc.ini so that you can modify it as normal user):&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155411</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155411"/>
		<updated>2010-01-21T20:13:16Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Using ODBC on Windows */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
Obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website] and install it on your system. Then:&lt;br /&gt;
&lt;br /&gt;
1) Navigate to Control Panel &amp;gt; Administrative Tools and double-click on Data Sources (ODBC)&lt;br /&gt;
&lt;br /&gt;
2) on the User DSN tab Click Add button and from the list of available drivers, select the MySQL ODBC Driver, and click OK.&lt;br /&gt;
&lt;br /&gt;
3) Input requires data in the appeared dialog:&lt;br /&gt;
&lt;br /&gt;
Data Source Name: it&amp;#039;s optional. Let it be &amp;quot;Mysql-test&amp;quot; in our case.&lt;br /&gt;
&lt;br /&gt;
Description: is optional as well.&lt;br /&gt;
&lt;br /&gt;
Server: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (in case mysql server is installed on the local machine, or IP Address if it&amp;#039;s on network machine)&lt;br /&gt;
&lt;br /&gt;
fill out user and password fields respectively. You should be able to see mysql databases under Database drop-down list, choose one. Click OK.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click Browse and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed) or obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website].&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and /etc/odbc.ini should have:&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155386</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155386"/>
		<updated>2010-01-21T14:02:30Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
Obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website] and install it on your system. Then:&lt;br /&gt;
&lt;br /&gt;
1) Navigate to Control Panel &amp;gt; Administrative Tools and double-click on Data Sources (ODBC)&lt;br /&gt;
&lt;br /&gt;
2) on the User DSN tab Click Add button and from the list of available drivers, select the MySQL ODBC Driver, and click OK.&lt;br /&gt;
&lt;br /&gt;
3) Input required data in the appeared dialog:&lt;br /&gt;
&lt;br /&gt;
Data Source Name: it&amp;#039;s optional. Let it be &amp;quot;Mysql-test&amp;quot; in our case.&lt;br /&gt;
&lt;br /&gt;
Description: is optional as well.&lt;br /&gt;
&lt;br /&gt;
Server: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (in case mysql server is installed on the local machine, or IP Address if it&amp;#039;s on network machine)&lt;br /&gt;
&lt;br /&gt;
fill out user and password fields respectively. You should be able to see mysql databases under Database drop-down list, choose one. Click OK.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click Browse and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed) or obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website].&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and /etc/odbc.ini should have:&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155385</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155385"/>
		<updated>2010-01-21T14:01:24Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Using ODBC on Windows */  (checkpoint save)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
Obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website] and install it on your system. Then:&lt;br /&gt;
&lt;br /&gt;
1) Navigate to Control Panel &amp;gt; Administrative Tools and double-click on Data Sources (ODBC)&lt;br /&gt;
&lt;br /&gt;
2) on the User DSN tab Click Add button and From the list of available drivers, select the MySQL ODBC Driver, and click OK.&lt;br /&gt;
&lt;br /&gt;
3) Input required data in the appeared dialog:&lt;br /&gt;
&lt;br /&gt;
Data Source Name: it&amp;#039;s optional. Let it be &amp;quot;Mysql-test&amp;quot; in our case.&lt;br /&gt;
&lt;br /&gt;
Description: is optional as well.&lt;br /&gt;
&lt;br /&gt;
Server: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (in case mysql server is installed on the local machine, or IP Address if it&amp;#039;s on network machine)&lt;br /&gt;
&lt;br /&gt;
fill out user and password fields respectively. You should be able to see mysql databases under Database drop-down list, choose one. Click OK.&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed) or obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website].&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and /etc/odbc.ini should have:&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155380</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155380"/>
		<updated>2010-01-21T13:36:02Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Using ODBC on Windows */  (checkpoint save)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
Obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website].&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed) or obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website].&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and /etc/odbc.ini should have:&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155377</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155377"/>
		<updated>2010-01-21T12:34:12Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Debian/Ubuntu */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed) or obtain [http://dev.mysql.com/downloads/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website].&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and /etc/odbc.ini should have:&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155376</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155376"/>
		<updated>2010-01-21T12:30:05Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Debian/Ubuntu */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed) or obtain [http://www.mysql.com/products/connector/odbc/ mysql-connector-odbc] from the [http://www.mysql.com MySQL website].&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and /etc/odbc.ini should have:&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155374</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155374"/>
		<updated>2010-01-21T12:21:31Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed).&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and /etc/odbc.ini should have:&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155373</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155373"/>
		<updated>2010-01-21T12:17:31Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Debian/Ubuntu */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed).&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
&lt;br /&gt;
1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
[MySQL]&lt;br /&gt;
&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and /etc/odbc.ini should have:&lt;br /&gt;
&lt;br /&gt;
[MySQL-test]&lt;br /&gt;
&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
&lt;br /&gt;
Server       = localhost&lt;br /&gt;
&lt;br /&gt;
Database     = test&lt;br /&gt;
&lt;br /&gt;
Port         = 3306&lt;br /&gt;
&lt;br /&gt;
Socket       =&lt;br /&gt;
&lt;br /&gt;
Option       = 3&lt;br /&gt;
&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next.&lt;br /&gt;
&lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155372</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155372"/>
		<updated>2010-01-21T12:14:05Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Using ODBC on Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Debian/Ubuntu ===&lt;br /&gt;
&lt;br /&gt;
 Install package libmyodbc from synaptic package manager (assuming package unixodbc is already installed).&lt;br /&gt;
&lt;br /&gt;
You need to have 2 files configured:&lt;br /&gt;
 1) /etc/odbcinst.ini should contain:&lt;br /&gt;
&lt;br /&gt;
  [MySQL]&lt;br /&gt;
Description = MySQL driver&lt;br /&gt;
Driver      = /usr/lib/odbc/libmyodbc.so&lt;br /&gt;
Setup       = /usr/lib/odbc/libodbcmyS.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2) and /etc/odbc.ini should have:&lt;br /&gt;
&lt;br /&gt;
 [MySQL-test]&lt;br /&gt;
Description  = MySQL database test&lt;br /&gt;
Driver       = MySQL&lt;br /&gt;
Server       = localhost&lt;br /&gt;
Database     = test&lt;br /&gt;
Port         = 3306&lt;br /&gt;
Socket       =&lt;br /&gt;
Option       = 3&lt;br /&gt;
ReadOnly     = No&lt;br /&gt;
&lt;br /&gt;
Then, Establishing connection by Creating New Base file:&lt;br /&gt;
&lt;br /&gt;
1) File &amp;gt; New &amp;gt; Database&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button Connect to an existing database and choose MySQL from the dropdown menu. Click on Next.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of Connect using ODBC, and then click on Next. &lt;br /&gt;
4) Click &amp;#039;&amp;#039;&amp;#039;Browse&amp;#039;&amp;#039;&amp;#039; and select created connection ([MySQL-test] should be in the list in our case) and next.&lt;br /&gt;
5) then enter username and Finish. Save file.&lt;br /&gt;
&lt;br /&gt;
For other Linux distros procedure should be pretty much the same in my opinion. You should just know the installation locations for files: libmyodbc.so and libodbcmyS.so, and replace them in the example above.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155371</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=155371"/>
		<updated>2010-01-21T12:05:05Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Operation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
Note that the use of the MySQL Java Connector requires MySQL to be installed and running on your Linux system. On Redhat/Enterprise Linux, MySQL can be installed and made to run via the following commands in a terminal;&lt;br /&gt;
&lt;br /&gt;
::su root&lt;br /&gt;
::yum install mysql-server mysql&lt;br /&gt;
::cd /sbin&lt;br /&gt;
::./chkconfig mysqld on&lt;br /&gt;
::/etc/init.d/mysqld start&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
&lt;br /&gt;
When you restart OpenOffice.org after installing the MySQL Java connect driver, you should now be able to create a new OpenOffice.org Base database document that can connect to your existing mysql database. Note that you will need to have first created your database on your mysql server. &lt;br /&gt;
&lt;br /&gt;
:: One method to do this requires using the mysql command line client;&lt;br /&gt;
:::mysqladmin -u root password NEWPASSWORD&lt;br /&gt;
:::mysql -u root -p&lt;br /&gt;
:::CREATE DATABASE newdatabasename;&lt;br /&gt;
:::CREATE USER &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039; IDENTIFIED BY &amp;#039;password&amp;#039;;	&lt;br /&gt;
:::GRANT ALL ON *.* TO &amp;#039;newusername&amp;#039;@&amp;#039;localhost&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
:: Another method to do this requires the use of a graphical user interface to administer your mysql server (for example PHPMyAdmin). &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) The next step varies depending upon the exact version of openoffice.org installed.&lt;br /&gt;
&lt;br /&gt;
::If the fields &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; are present, perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; field, enter the name of your mysql database as it is called on the mysql server, paying attention to the spelling. &lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;. An example Server URL would be: localhost, 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
::If only the field &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; is present perform the following;&lt;br /&gt;
&lt;br /&gt;
:::In the &amp;#039;&amp;#039;&amp;#039;Data Source URL&amp;#039;&amp;#039;&amp;#039; field, enter a combination of the servername, port (optional), and data base name, in the following format; jdbc:mysql://serverAddress:3306/databaseName (or jdbc:mysql://serverAddress/databaseName without the port number). An example Server Address would be: &amp;#039;&amp;#039;&amp;#039;localhost&amp;#039;&amp;#039;&amp;#039; (if mysql server is installed on local computer), 192.168.1.1, or 96.115.86.166, or something like that if mysql server is installed on network computer.&lt;br /&gt;
&lt;br /&gt;
::For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. If you get an error indicating a character conversion error, edit both the [client] and [mysqld] sections of my.cnf to include default-character-set=utf8 in both sections. Restart the mysql server.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;. NOTE: In Ubuntu my.cnf is located in /etc/mysql&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Database/Drivers/MySQL_Native/Beta&amp;diff=136486</id>
		<title>Database/Drivers/MySQL Native/Beta</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Database/Drivers/MySQL_Native/Beta&amp;diff=136486"/>
		<updated>2009-07-31T15:11:04Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Sun MySQL Connector/OOo (Beta)}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
MySQL Connector/OpenOffice.org is a MySQL driver for [http://www.openoffice.org/ OpenOffice.org]. It can be used to connect from OpenOffice.org 3.1 to a MySQL server 5.1 or newer.&lt;br /&gt;
&lt;br /&gt;
Before MySQL Connector/OpenOffice.org became available you&amp;#039;d have to use [http://dev.mysql.com/downloads/connector/j/ MySQL Connector/J (JDBC)] or [http://dev.mysql.com/downloads/connector/odbc/ MySQL Connector/ODBC] to connect to a MySQL server.&lt;br /&gt;
&lt;br /&gt;
Therefore the driver is also referred to as a native driver in the context of OpenOffice.org. The term native driver clashes with the MySQL definition of a native driver. MySQL Connector/OpenOffice.org does not implement the MySQL Client Server protocol. Technically speaking the MySQL Connector/OpenOffice.org is implemented as a proxy on top of the [http://dev.mysql.com/doc/refman/5.1/en/connector-cpp.html MySQL Connector/C++].&lt;br /&gt;
&lt;br /&gt;
The driver is delivered as an OpenOffice.org extension.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
Using MySQL Connector/OpenOffice.org has the following advantages:&lt;br /&gt;
&lt;br /&gt;
* Easy installation through the OpenOffice.org Extension Manager.&lt;br /&gt;
* Seamless integration into OpenOffice.org.&lt;br /&gt;
* You can work on multiple MySQL schemata (databases) simultaneously&lt;br /&gt;
* No need to go through an additional Connector installation routine (ODBC/JDBC)&lt;br /&gt;
* No need to configure or register an additional Connector (ODBC)&lt;br /&gt;
* No need to install or configure a driver manager (ODBC)&lt;br /&gt;
* No need for a Java Runtime Environment (JDBC)&lt;br /&gt;
&lt;br /&gt;
=== Status ===&lt;br /&gt;
&lt;br /&gt;
Please note, the MySQL Connector/OpenOffice.org is released as a beta version. We do not recommend using the driver in production environments or systems with critical data. Please note, official support is not available.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Install or upgrade to OpenOffice.org 3.1  ===&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org 3.1 is available from OpenOffice.org&amp;#039;s [http://download.openoffice.org download site]. The driver does not work together with any other OpenOffice.org version. &lt;br /&gt;
&lt;br /&gt;
Please use &amp;quot;vanilla&amp;quot; OpenOffice.org: As with all extensions containing binary code, they&amp;#039;re potentially incompatible with other OpenOffice.org distributions (like the one from your favorite Linux distribution), and are not necessarily expected to work with them.&lt;br /&gt;
&lt;br /&gt;
Caution: The installation wizard of OpenOffice.org 3.1 will remove older OpenOffice.org installations from your system by default. If you do not want this, check out for the corresponding settings of the installation wizard.&lt;br /&gt;
&lt;br /&gt;
=== Download MySQL Connector/OpenOffice.org ===&lt;br /&gt;
&lt;br /&gt;
The extension is available from the [http://extensions.services.openoffice.org/project/mysql_connector OpenOffice.org extensions repository]. It is provided for the usual 6 platforms (Windows, Linux Intel 32 Bit, Linux Intel 64 Bit, Solaris Sparc, Solaris Intel 32 Bit, Mac OS X Intel).&lt;br /&gt;
&lt;br /&gt;
Download the file to a location of your choice, for example &amp;lt;code&amp;gt;My Documents&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;~/Documents&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Installing the extension ===&lt;br /&gt;
&lt;br /&gt;
Add the &amp;lt;code&amp;gt;.oxt&amp;lt;/code&amp;gt; extension through the Extension Manager of OpenOffice.org. In OpenOffice.org, select &amp;lt;code&amp;gt;Tools, Extension Manager...&amp;lt;/code&amp;gt; and specify the &amp;lt;code&amp;gt;.oxt&amp;lt;/code&amp;gt; file as a new extension. When done, MySQL Connector/OpenOffice.org should show up as a new extension under &amp;lt;code&amp;gt;My Extensions&amp;lt;/code&amp;gt;.&lt;br /&gt;
: &amp;lt;br/&amp;gt;[[Image:Conn_ooo_alpha_extensions.png]]&lt;br /&gt;
&lt;br /&gt;
Restart OpenOffice.org to complete the installation.&lt;br /&gt;
&lt;br /&gt;
== Getting Started: Connecting to MySQL ==&lt;br /&gt;
&lt;br /&gt;
MySQL Connector/OpenOffice.org allows you to access the MySQL Server and its schemata from the OpenOffice.org suite.&lt;br /&gt;
&lt;br /&gt;
The following example demonstrates the creation of a new OpenOffice.org Base database which uses a local MySQL Server for storage and the new connector for connecting.&lt;br /&gt;
&lt;br /&gt;
=== Select the database ===&lt;br /&gt;
&lt;br /&gt;
Create a new database (&amp;lt;code&amp;gt;File, New, Database&amp;lt;/code&amp;gt;). This starts a wizard that allows you to create a new, open an existing, or connect to existing database. Select the latter option.&lt;br /&gt;
&lt;br /&gt;
From the drop-down list, select &amp;lt;code&amp;gt;MySQL&amp;lt;/code&amp;gt;. Click &amp;lt;code&amp;gt;Next&amp;amp;nbsp;&amp;amp;gt;&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Conn_ooo_alpha_wizard1.png]]&lt;br /&gt;
&lt;br /&gt;
=== Select the type of the driver ===&lt;br /&gt;
&lt;br /&gt;
You can use three different MySQL drivers for connecting to MySQL from OpenOffice.org. You can choose a generic ODBC or JDBC connection method or the native driver. Select &amp;lt;code&amp;gt;Connect native&amp;lt;/code&amp;gt;. Click &amp;lt;code&amp;gt;Next&amp;amp;nbsp;&amp;amp;gt;&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Conn_ooo_alpha_wizard2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Setting up the database connection ===&lt;br /&gt;
&lt;br /&gt;
Set up the database connection. Put the schema (database) you want to connect to into &amp;lt;code&amp;gt;Name of the database&amp;lt;/code&amp;gt;. Enter the URL (host name, or simply type &amp;lt;code&amp;gt;localhost&amp;lt;/code&amp;gt; when connecting to the server on your own PC), Port and Socket (or leave socket empty) of your MySQL Server. Click &amp;lt;code&amp;gt;Next&amp;amp;nbsp;&amp;amp;gt;&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Conn_ooo_alpha_wizard3.png]]&lt;br /&gt;
&lt;br /&gt;
=== Fill in user credentials ===&lt;br /&gt;
&lt;br /&gt;
Provide the user credentials for connecting to your MySQL Server. Click &amp;lt;code&amp;gt;Next&amp;amp;nbsp;&amp;amp;gt;&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Conn_ooo_alpha_wizard4.png]]&lt;br /&gt;
&lt;br /&gt;
=== Save and proceed ===&lt;br /&gt;
&lt;br /&gt;
Finish the wizard. All defaults are a safe choice. Click &amp;lt;code&amp;gt;Finish&amp;amp;nbsp;&amp;amp;gt;&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Conn_ooo_alpha_wizard5.png]]&lt;br /&gt;
&lt;br /&gt;
== Getting Started: Usage Examples  ==&lt;br /&gt;
&lt;br /&gt;
=== Listing Tables  ===&lt;br /&gt;
&lt;br /&gt;
In the Database area of the Base main window, select Tables. If this is the first time you&amp;#039;re accessing the database you&amp;#039;ll be prompted for your credentials (username and password); you can store these settings for your current Base session. &lt;br /&gt;
&lt;br /&gt;
[[Image:Conn ooo alpha base.png]] &lt;br /&gt;
&lt;br /&gt;
Depending on your connection settings you will now see all databases with all their tables, or just the database you&amp;#039;ve specified in the connection settings.&lt;br /&gt;
&lt;br /&gt;
== Known Bugs  ==&lt;br /&gt;
&lt;br /&gt;
There are currently [[Database/Drivers/MySQL Native/Beta/Known Issues|3 known bugs]] in the Beta version of the driver, which will be fixed &amp;#039;till the final release. &lt;br /&gt;
&lt;br /&gt;
If you discover a bug, please send an email to [mailto:users@dba.openoffice.org users@dba.openoffice.org]. It&amp;#039;s a low-volume list with less than 10 mails per day. If you prefer reading it by means other than subscribing to it, see [[Base Mailing List|here]].&lt;br /&gt;
&lt;br /&gt;
== Contact ==&lt;br /&gt;
&lt;br /&gt;
To discuss the new MySQL Connector/OpenOffice.org, please subscribe to the mailing list [http://dba.openoffice.org/servlets/ProjectMailingListList users@dba.openoffice.org]. It is a low-volume list with less than 10 mails per day.&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Database/Drivers/MySQL_Native/Beta&amp;diff=136485</id>
		<title>Database/Drivers/MySQL Native/Beta</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Database/Drivers/MySQL_Native/Beta&amp;diff=136485"/>
		<updated>2009-07-31T15:07:45Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Sun MySQL Connector/OOo (Beta)}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
MySQL Connector/OpenOffice.org is a MySQL driver for [http://www.openoffice.org/ OpenOffice.org]. It can be used to connect from OpenOffice.org 3.1 to a MySQL server 5.1 or newer.&lt;br /&gt;
&lt;br /&gt;
Before MySQL Connector/OpenOffice.org became available you&amp;#039;d have to use [http://dev.mysql.com/downloads/connector/j/ MySQL Connector/J (JDBC)] or [http://dev.mysql.com/downloads/connector/odbc/ MySQL Connector/ODBC] to connect to a MySQL server.&lt;br /&gt;
&lt;br /&gt;
Therefore the driver is also referred to as a native driver in the context of OpenOffice.org. The term native driver clashes with the MySQL definition of a native driver. MySQL Connector/OpenOffice.org does not implement the MySQL Client Server protocol. Technically speaking the MySQL Connector/OpenOffice.org is implemented as a proxy on top of the [http://dev.mysql.com/doc/refman/5.1/en/connector-cpp.html MySQL Connector/C++].&lt;br /&gt;
&lt;br /&gt;
The driver is delivered as an OpenOffice.org extension.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
Using MySQL Connector/OpenOffice.org has the following advantages:&lt;br /&gt;
&lt;br /&gt;
* Easy installation through the OpenOffice.org Extension Manager.&lt;br /&gt;
* Seamless integration into OpenOffice.org.&lt;br /&gt;
* You can work on multiple MySQL schemata (databases) simultaneously&lt;br /&gt;
* No need to go through an additional Connector installation routine (ODBC/JDBC)&lt;br /&gt;
* No need to configure or register an additional Connector (ODBC)&lt;br /&gt;
* No need to install or configure a driver manager (ODBC)&lt;br /&gt;
* No need for a Java Runtime Environment (JDBC)&lt;br /&gt;
&lt;br /&gt;
=== Status ===&lt;br /&gt;
&lt;br /&gt;
Please note, the MySQL Connector/OpenOffice.org is released as a beta version. We do not recommend using the driver in production environments or systems with critical data. Please note, official support is not available.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Install or upgrade to OpenOffice.org 3.1  ===&lt;br /&gt;
&lt;br /&gt;
OpenOffice.org 3.1 is available from OpenOffice.org&amp;#039;s [http://download.openoffice.org download site]. The driver does not work together with any other OpenOffice.org version. &lt;br /&gt;
&lt;br /&gt;
Please use &amp;quot;vanilla&amp;quot; OpenOffice.org: As with all extensions containing binary code, they&amp;#039;re potentially incompatible with other OpenOffice.org distributions (like the one from your favorite Linux distribution), and are not necessarily expected to work with them.&lt;br /&gt;
&lt;br /&gt;
Caution: The installation wizard of OpenOffice.org 3.1 will remove older OpenOffice.org installations from your system by default. If you do not want this, check out for the corresponding settings of the installation wizard.&lt;br /&gt;
&lt;br /&gt;
=== Download MySQL Connector/OpenOffice.org ===&lt;br /&gt;
&lt;br /&gt;
The extension is available from the [http://extensions.services.openoffice.org/project/mysql_connector OpenOffice.org extensions repository]. It is provided for the usual 6 platforms (Windows, Linux Intel 32 Bit, Linux Intel 64 Bit, Solaris Sparc, Solaris Intel 32 Bit, Mac OS X Intel).&lt;br /&gt;
&lt;br /&gt;
Download the file to a location of your choice, for example &amp;lt;code&amp;gt;My Documents&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;~/Documents&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Installing the extension ===&lt;br /&gt;
&lt;br /&gt;
Add the &amp;lt;code&amp;gt;.oxt&amp;lt;/code&amp;gt; extension through the Extension Manager of OpenOffice.org. In OpenOffice.org, select &amp;lt;code&amp;gt;Tools, Extension Manager...&amp;lt;/code&amp;gt; and specify the &amp;lt;code&amp;gt;.oxt&amp;lt;/code&amp;gt; file as a new extension. When done, MySQL Connector/OpenOffice.org should show up as a new extension under &amp;lt;code&amp;gt;My Extensions&amp;lt;/code&amp;gt;.&lt;br /&gt;
: &amp;lt;br/&amp;gt;[[Image:Conn_ooo_alpha_extensions.png]]&lt;br /&gt;
&lt;br /&gt;
Restart OpenOffice.org to complete the installation.&lt;br /&gt;
&lt;br /&gt;
== Getting Started: Connecting to MySQL ==&lt;br /&gt;
&lt;br /&gt;
MySQL Connector/OpenOffice.org allows you to access the MySQL Server and its schemata from the OpenOffice.org suite.&lt;br /&gt;
&lt;br /&gt;
The following example demonstrates the creation of a new OpenOffice.org Base database which uses a local MySQL Server for storage and the new connector for connecting.&lt;br /&gt;
&lt;br /&gt;
=== Select the database ===&lt;br /&gt;
&lt;br /&gt;
Create a new database (&amp;lt;code&amp;gt;File, New, Database&amp;lt;/code&amp;gt;). This starts a wizard that allows you to create a new, open an existing, or connect to existing database. Select the latter option.&lt;br /&gt;
&lt;br /&gt;
From the drop-down list, select &amp;lt;code&amp;gt;MySQL&amp;lt;/code&amp;gt;. Click &amp;lt;code&amp;gt;Next&amp;amp;nbsp;&amp;amp;gt;&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Conn_ooo_alpha_wizard1.png]]&lt;br /&gt;
&lt;br /&gt;
=== Select the type of the driver ===&lt;br /&gt;
&lt;br /&gt;
You can use three different MySQL drivers for connecting to MySQL from OpenOffice.org. You can choose a generic ODBC or JDBC connection method or the native driver. Select &amp;lt;code&amp;gt;Connect native&amp;lt;/code&amp;gt;. Click &amp;lt;code&amp;gt;Next&amp;amp;nbsp;&amp;amp;gt;&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Conn_ooo_alpha_wizard2.png]]&lt;br /&gt;
&lt;br /&gt;
=== Setting up the database connection ===&lt;br /&gt;
&lt;br /&gt;
Set up the database connection. Put the schema (database) you want to connect to into &amp;lt;code&amp;gt;Name of the database&amp;lt;/code&amp;gt; (simply type &amp;lt;code&amp;gt;localhost&amp;lt;/code&amp;gt; when connecting to the server on your own PC). Enter the URL (host name), Port and Socket (or leave socket empty) of your MySQL Server. Click &amp;lt;code&amp;gt;Next&amp;amp;nbsp;&amp;amp;gt;&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Conn_ooo_alpha_wizard3.png]]&lt;br /&gt;
&lt;br /&gt;
=== Fill in user credentials ===&lt;br /&gt;
&lt;br /&gt;
Provide the user credentials for connecting to your MySQL Server. Click &amp;lt;code&amp;gt;Next&amp;amp;nbsp;&amp;amp;gt;&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Conn_ooo_alpha_wizard4.png]]&lt;br /&gt;
&lt;br /&gt;
=== Save and proceed ===&lt;br /&gt;
&lt;br /&gt;
Finish the wizard. All defaults are a safe choice. Click &amp;lt;code&amp;gt;Finish&amp;amp;nbsp;&amp;amp;gt;&amp;amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Conn_ooo_alpha_wizard5.png]]&lt;br /&gt;
&lt;br /&gt;
== Getting Started: Usage Examples  ==&lt;br /&gt;
&lt;br /&gt;
=== Listing Tables  ===&lt;br /&gt;
&lt;br /&gt;
In the Database area of the Base main window, select Tables. If this is the first time you&amp;#039;re accessing the database you&amp;#039;ll be prompted for your credentials (username and password); you can store these settings for your current Base session. &lt;br /&gt;
&lt;br /&gt;
[[Image:Conn ooo alpha base.png]] &lt;br /&gt;
&lt;br /&gt;
Depending on your connection settings you will now see all databases with all their tables, or just the database you&amp;#039;ve specified in the connection settings.&lt;br /&gt;
&lt;br /&gt;
== Known Bugs  ==&lt;br /&gt;
&lt;br /&gt;
There are currently [[Database/Drivers/MySQL Native/Beta/Known Issues|3 known bugs]] in the Beta version of the driver, which will be fixed &amp;#039;till the final release. &lt;br /&gt;
&lt;br /&gt;
If you discover a bug, please send an email to [mailto:users@dba.openoffice.org users@dba.openoffice.org]. It&amp;#039;s a low-volume list with less than 10 mails per day. If you prefer reading it by means other than subscribing to it, see [[Base Mailing List|here]].&lt;br /&gt;
&lt;br /&gt;
== Contact ==&lt;br /&gt;
&lt;br /&gt;
To discuss the new MySQL Connector/OpenOffice.org, please subscribe to the mailing list [http://dba.openoffice.org/servlets/ProjectMailingListList users@dba.openoffice.org]. It is a low-volume list with less than 10 mails per day.&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Talk:Connect_MySQL_and_Base&amp;diff=130351</id>
		<title>Talk:Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Talk:Connect_MySQL_and_Base&amp;diff=130351"/>
		<updated>2009-05-31T09:44:15Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I cut &amp;quot;jdbc:mysql://serverAddress:3306/databaseName, just as one would code a connection in a Java application.&amp;quot; from page because that would be relevant to JDBC connection and there is discussed an example when MySql is chosen in drop-down list.     ottoshmidt, 31 May 2009&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Talk:Connect_MySQL_and_Base&amp;diff=130350</id>
		<title>Talk:Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Talk:Connect_MySQL_and_Base&amp;diff=130350"/>
		<updated>2009-05-31T09:43:24Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: New page: I cut &amp;quot;jdbc:mysql://serverAddress:3306/databaseName, just as one would code a connection in a Java application.&amp;quot; from page because that would be relevant to JDBC connection and there is di...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I cut &amp;quot;jdbc:mysql://serverAddress:3306/databaseName, just as one would code a connection in a Java application.&amp;quot; from page because that would be relevant to JDBC connection and there is discussed an example when MySql is chosen in drop-down list.&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=130349</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=130349"/>
		<updated>2009-05-31T09:41:06Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: /* Operation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
When you restart OpenOffice.org, you should now be able to create a new database document that can connect to your existing mysql database, i.e. you need to have created your database first on your mysql server, for example with the CREATE DATABASE command from the mysql command line client or from within PHPMyAdmin if you are using that graphical user interface to administer your mysql server. &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) In the following dialog, enter the name of your mysql database in the field &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; as it is called on the mysql server, paying attention to the spelling. In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;.  An example Datasource URL would be: 192.168.1.1, or 96.115.86.166, or something like that.&lt;br /&gt;
&lt;br /&gt;
For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
	<entry>
		<id>https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=130348</id>
		<title>Connect MySQL and Base</title>
		<link rel="alternate" type="text/html" href="https://wiki.openoffice.org/w/index.php?title=Connect_MySQL_and_Base&amp;diff=130348"/>
		<updated>2009-05-31T09:40:18Z</updated>

		<summary type="html">&lt;p&gt;Ottoshmidt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here is a tutorial to connect MySQL database with OpenOffice.org Base. &lt;br /&gt;
&lt;br /&gt;
OpenOffice.org comes directly with support of JDBC connectivity to multiple databases. OpenOffice.org needs [http://www.java.com/en/download/index.jsp Java Runtime Environment] to be able to use JDBC. Verify that you have JRE on your OOo by going to &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General - Java&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Windows ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
First, download and unzip the java archive. Obtain the [http://www.mysql.com/products/connector/j/ mysql-connector-J] from the [http://www.mysql.com MySQL website]. Follow the instructions on the [http://www.mysql.com MySQL website]to find and then download a gzipped and zipped set of files to a convenient location on the local computer. The target file will be named something like &amp;quot;mysql-connector-java-x.x.x.zip.&amp;quot; Following the appropriate method for your zip program, unzip the downloaded file to a permanent location, for example, c:\Program Files\mySQL-Connector\. (NOTE: In Windows systems, double-clicking a zipped file usually gives access to the contents of the zip file, whereupon you may select from the resulting explorer window &amp;quot;Extract Files.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Next, make OOo aware of the newly downloaded java archive.  Start OpenOffice.org and on the menu select &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org - Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;; then click on the button &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039;; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located (see previous step). Click on the mysql-connector-x.x.x-java-bin.jar file once to highlight and click on the button &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;. The mysql-connector-x.x.x-java-bin.jar file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; to close the dialog. OpenOffice.org will notify you that you need restart the program for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
Finally, restart OOo and check functionality.  Close OpenOffice.org &amp;#039;&amp;#039;&amp;#039;completely&amp;#039;&amp;#039;&amp;#039;, that is, close all open OOo windows and shut down the quickstarter program located in the system tray (if it is running). Restart OpenOffice.org, and the JDBC connector should then be available and functioning.&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
See Operation below under Linux.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Windows ==&lt;br /&gt;
&lt;br /&gt;
== Using JDBC on Linux ==&lt;br /&gt;
=== Installation ===&lt;br /&gt;
Download the [http://www.mysql.com/products/connector/j/ mysql-connector-J] which you can download from the [http://www.mysql.com MySQL website]. [http://www.mysql.com/products/connector/j/ MySQL Connector/J] adds JDBC connectivity to MySQL. Unpack, untar or unzip the downloaded file anywhere where you can access it as a normal user, for example, to your desktop. On KDE, you can use Ark, on Gnome FileRoller, or even the Nautilus scripts that are included in some Linux distributions, or the usual &amp;quot;tar -zvf&amp;quot; from a console. A directory is created at the desired location named mysql-connector-java-x.x.x, where the x.x.x represents the version number of the JDBC connector you have downloaded. Inside this directory, you will find a file called mysql-connector-x.x.x-java-bin.jar.&lt;br /&gt;
&lt;br /&gt;
Start OpenOffice.org and go to the menu &amp;#039;&amp;#039;&amp;#039;Tools - Options - OpenOffice.org General Java&amp;#039;&amp;#039;&amp;#039;. Click on the button &amp;#039;&amp;#039;&amp;#039;Class Path...&amp;#039;&amp;#039;&amp;#039;, then choose &amp;#039;&amp;#039;&amp;#039;Add Archive...&amp;#039;&amp;#039;&amp;#039; and navigate to where the mysql-connector-x.x.x-java-bin.jar file is located. Click on &amp;#039;&amp;#039;&amp;#039;Open&amp;#039;&amp;#039;&amp;#039;, and the file should then appear in the list of &amp;#039;&amp;#039;&amp;#039;Assigned folders and Archives&amp;#039;&amp;#039;&amp;#039;. You can then click on &amp;#039;&amp;#039;&amp;#039;OK&amp;#039;&amp;#039;&amp;#039; and close OpenOffice.org completely. You may receive a message indicating that you have to do that anyway in order for OpenOffice.org to be able recognize your changes correctly. If the OpenOffice.org quickstarter is running, you should close that application as well.&lt;br /&gt;
&lt;br /&gt;
Instead of downloading the connector from the MySQL download site, you can also use the corresponding packages of your distribution like&lt;br /&gt;
* libmysql-java for debian and ubuntu&lt;br /&gt;
&lt;br /&gt;
=== Operation ===&lt;br /&gt;
When you restart OpenOffice.org, you should now be able to create a new database document that can connect to your existing mysql database, i.e. you need to have created your database first on your mysql server, for example with the CREATE DATABASE command from the mysql command line client or from within PHPMyAdmin if you are using that graphical user interface to administer your mysql server. &lt;br /&gt;
&lt;br /&gt;
Now do the following :&lt;br /&gt;
&lt;br /&gt;
1) &amp;#039;&amp;#039;&amp;#039;File &amp;gt; New &amp;gt; Database&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
2) Click on the radio button &amp;#039;&amp;#039;&amp;#039;Connect to an existing database&amp;#039;&amp;#039;&amp;#039; and choose &amp;#039;&amp;#039;&amp;#039;MySQL&amp;#039;&amp;#039;&amp;#039; from the dropdown menu. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
3) In the next dialog, you should accept the default choice of &amp;#039;&amp;#039;&amp;#039;Connect using JDBC&amp;#039;&amp;#039;&amp;#039;, and then click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
4) In the following dialog, enter the name of your mysql database in the field &amp;#039;&amp;#039;&amp;#039;Name of the database&amp;#039;&amp;#039;&amp;#039; as it is called on the mysql server, paying attention to the spelling. In the &amp;#039;&amp;#039;&amp;#039;Server URL&amp;#039;&amp;#039;&amp;#039; field, enter either the fully qualified internet domain name of the server on which your mysql server is running, or its IP address or, if you are running the mysql server locally on your own computer, simply type localhost. You can adjust the connection port or leave default port 3306 in the field &amp;#039;&amp;#039;&amp;#039;Port number&amp;#039;&amp;#039;&amp;#039;.  An example Datasource URL would be: 192.168.1.1, or 96.115.86.166  etc.&lt;br /&gt;
&lt;br /&gt;
For the field &amp;#039;&amp;#039;&amp;#039;MySQL JDBC driver class:&amp;#039;&amp;#039;&amp;#039; enter the class name for the JDBC driver you installed. You can find the correct class name in the documentation that came with the driver. MySQL java connector archive version 5.1.6 contains connector-j.pdf document with description in subdirectory docs. The class name is &amp;#039;&amp;#039;&amp;#039;com.mysql.jdbc.Driver&amp;#039;&amp;#039;&amp;#039; for version 5.1.6. Click on &amp;#039;&amp;#039;&amp;#039;Test Class&amp;#039;&amp;#039;&amp;#039; just to make sure that you have correctly set up the access to the connector as detailed above. If the connector has been set up correctly, you will get a message that says &amp;#039;&amp;#039;&amp;#039;The JDBC driver was loaded correctly&amp;#039;&amp;#039;&amp;#039;. Now click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
5) Now enter the name of the user and the password (if required by the mysql server) that you have previously created for use of the database on the mysql server. If you click on &amp;#039;&amp;#039;&amp;#039;Test Connection&amp;#039;&amp;#039;&amp;#039;, you will be asked for a password if you have ticked the password box beforehand. If the connection to the database succeeds, you will get a message &amp;#039;&amp;#039;&amp;#039;Connection test: The connection was established successfully&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Next&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
6) On the final screen of the database wizard dialog, you can in general leave the default settings as they are, i.e. &amp;#039;&amp;#039;&amp;#039;Yes, register the database for me&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Open the database for editing&amp;#039;&amp;#039;&amp;#039;. Click on &amp;#039;&amp;#039;&amp;#039;Finish&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
7) You will be asked for a file name to give to your database document. Once you have done this and clicked on &amp;#039;&amp;#039;&amp;#039;Save&amp;#039;&amp;#039;&amp;#039;, the database document will open, and the Forms button on the left will be highlighted. Congratulations, you have now connected to your MySQL database via the JDBC connector.&lt;br /&gt;
&lt;br /&gt;
== Using ODBC on Linux ==&lt;br /&gt;
OpenOffice.org also support ODBC connectivity to MySQL, you will need [http://www.unixodbc.org/ Unix-ODBC] in order to make a connection through it.&lt;br /&gt;
&lt;br /&gt;
== Recommendations settings ==&lt;br /&gt;
&lt;br /&gt;
Known issues regarding MySQL and OpenOffice.org can be avoided by having specific settings here are some of those:&lt;br /&gt;
&lt;br /&gt;
=== MySQL settings ===&lt;br /&gt;
&lt;br /&gt;
* Make sure that MySQL is using TCP/IP as opposed to sockets. Edit the my.cnf file at /etc/ and comment &amp;#039;&amp;#039;&amp;#039;skip-networking&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
=== OpenOffice.org settings ===&lt;br /&gt;
&lt;br /&gt;
* OpenOffice.org uses Java for JDBC, please make sure you have JRE at Tools - Options - OpenOffice.org General - Java&lt;br /&gt;
* Declare the &amp;#039;&amp;#039;&amp;#039;mysql-connector-j.bin&amp;#039;&amp;#039;&amp;#039; at the classpath at Tools - Options - OpenOFfice.org General - Java&lt;br /&gt;
* MySQL and JDBC on Debian Testing: Package sun-java6-jre from the non-free repository is needed and has to be activated in &amp;quot;Options-&amp;gt; OpenOffice.org -&amp;gt; Java&amp;quot;. The FSF java environment will not work returning a SQL syntax code whenever connecting to the MySQL server (July 27th 2008).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Database]]&lt;/div&gt;</summary>
		<author><name>Ottoshmidt</name></author>
	</entry>
</feed>