| View previous topic :: View next topic |
| Author |
Message |
coume General User

Joined: 27 May 2003 Posts: 36
|
Posted: Thu Apr 21, 2005 4:30 am Post subject: Connect to a mysql DB using macro |
|
|
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
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 |
|
 |
Danad OOo Advocate

Joined: 22 Feb 2004 Posts: 293 Location: Brasil
|
|
| Back to top |
|
 |
pitonyak Administrator


Joined: 09 Mar 2004 Posts: 3622 Location: Columbus, Ohio, USA
|
Posted: Thu Apr 21, 2005 7:57 pm Post subject: |
|
|
| 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 |
|
 |
|