OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Connect to a mysql DB using macro

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
coume
General User
General User


Joined: 27 May 2003
Posts: 36

PostPosted: Thu Apr 21, 2005 4:30 am    Post subject: Connect to a mysql DB using macro Reply with quote

Hello,

I'm trying to connect to a mysql DB to import and export data with it...
But I can't find the right way to connect Sad

Anyone having a sample code to show for a db requiring password.

Thanks in advance
Ludo
_________________
http://www.mythTVtalk.com - Where the World comes to speak about MythTV!
Hundreds of MythTV users already joined the community! What are you waiting to be the next one?
Back to top
View user's profile Send private message Visit poster's website
Danad
OOo Advocate
OOo Advocate


Joined: 22 Feb 2004
Posts: 293
Location: Brasil

PostPosted: Thu Apr 21, 2005 5:32 pm    Post subject: Reply with quote

Quote:
Anyone having a sample code to show for a db requiring password


Get this ...

http://docs.sun.com/db/doc/817-1826?q=StarOffice

... and look at section Database Access

HTH
Back to top
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3655
Location: Columbus, Ohio, USA

PostPosted: Thu Apr 21, 2005 7:57 pm    Post subject: Reply with quote

Code:
  sUser$ = "user"
  sPass$ = "password"
  sURL$  = "sdbc:mysql:jdbc:localhost:3306/stamps"

  oManager = CreateUnoService("com.sun.star.sdbc.DriverManager")
  AppendProperty(oParms(), "user", sUser)
  AppendProperty(oParms(), "password", sPass)
  AppendProperty(oParms(), "JavaDriverClass", "com.mysql.jdbc.Driver")
  oCon = oManager.getConnectionWithInfo(sURL, oParms())


If you are just starting out, then note that this is just a code snippet from stuff that I use and I did not include the AppendProperty routine.
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group