Bruce and Fabien,
My email a few days back gave the code that I am using to open sqlite
databases. That code opens a db in any directory you have access to. Is
there something I am not understanding about Bruce's question?
The code is attached.
paul
On 08/27/2013 12:42 AM, Fabien Bodard wrote:
And then if you configure the connection ide you can use :
Connections["Connection1"].Open()
2013/8/26 Tobias Boege [1]<tabo...@gmail.com>
On Mon, 26 Aug 2013, Bruce wrote:
What syntax for "DatabaseURL As String"?
I'm trying to create a connection to an SQLite db in a different gambas
project source directory:
$conn = New
Connection("/share/projects/gambas3_proj/horse/horseBO/.connection/bometa.conne
ction")
(and various other path strings to the connection definition).
All I get is "Malformed URL" error.
>From the sources, I deduce the following format (and it works here):
$TYPE://$USER@$HOST:$PORT/$DB
where the :$PORT part is optional.
So to connect to something like
hConn = New Connection
With hConn
.Type = "mysql"
.Login = "root"
.Password = "toor"
.Host = "localhost"
.Port = 3306
.Name = "test"
.Open()
End With
you could write
hConn = New Connection("mysql://root@localhost:3306/test")
hConn.Passwort = "toor"
hConn.Open()
Regards,
Tobi
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
[2]http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
[3]Gambas-user@lists.sourceforge.net
[4]https://lists.sourceforge.net/lists/listinfo/gambas-user
References
1. mailto:tabo...@gmail.com
2.
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
3. mailto:Gambas-user@lists.sourceforge.net
4. https://lists.sourceforge.net/lists/listinfo/gambas-user
This will allow you to open a connection anywhere. All you have to change is
the "sName" and the .Host entry
Enjoy!
paul
'' Put these at the beginning of your program on your form named fMain:
Public $hConn As New Connection
Public sMyPath As String
Public sAppPath As String
'' Your routine to open the connection:
Public Sub Open_DB()
' If you want to see the commands sent to the database then uncomment
this line:
' DB.Debug = True
' For debug purposes only:
Print "$hConn.Opened from fMain Form (s/b F) = " & Str($hConn.Opened)
sName = "MyDatabaseName.sqlite"
' For debug purposes only:
Print "sName = " & sName
With $hConn
.Type = "sqlite3" ' DB type for your database
.Host = "/share/projects/gambas3_proj/horse/
.Name = sName 'Example: "MyDatabaseName.sqlite"
End With
' I had multiple kinds of catch statements. This is for debugging the
opening of a connection
sTryMessage = "OpenConn"
Print "Try to open connection for use"
Try $hConn.Open
' For debug purposes only:
Print "$hConn.Opened from fMain Form (s/b T) = " & Str($hConn.Opened)
Print "Connection Host = " & $hConn.Host
Catch
If sTryMessage = "OpenConn" Then
If errorMessageHeader = "" Then
errorMessageHeader = "Could not open DB connection in fMain
Form Open on " & sName & " On " & sMyPath
Print "Connection Open Error in fMain Form Open " & Error.Text
Error.Raise(Error.Text & " in fMain Form Open")
End If
Endif
End
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user