sql online

101 views
Skip to first unread message

PrecySite TV

unread,
Apr 19, 2024, 11:12:55 AMApr 19
to DroidScript
huy guys, how can i connect to the online database like postgresql or mysql usinng native in droidscript

Oarabile Koore

unread,
Apr 19, 2024, 4:39:51 PMApr 19
to DroidScript
try using the new ESM(2.69b1) feature, or import the script you need using app.Script

Dave

unread,
Apr 19, 2024, 5:04:06 PMApr 19
to DroidScript
We have just released a new beta version of DS with a Premium+ subscription option which gives you a personal cloud server with an SQL database included as well.  If you want to try it out you can download it here - http://androidscript.org/beta/DroidScript_269b1/

Once you subscribe you need to send an email to support[at]droidscript.org requesting your cloud account activation key.

Then you can use the following code to connect to the DB

app.Import( "PocketBase", "ds:Html/pocketbase.es.js" )

async function OnStart()
{
    try {
        var pb = new PocketBase('https://fred-db.droidscript.cloud')
        await pb.collection('users').authWithPassword('fr...@fred.com', '123456789')
        const records = await pb.collection('people').getFullList({
            sort: '-created',
        })
        alert( JSON.stringify(records) )
    }
    catch( e ) {
        console.error( e )
    }
}

Reply all
Reply to author
Forward
0 new messages