Jump to content

Connecting to DB?


Smuds

Recommended Posts

Hi guys, trying to connect to a DB in a script.  Is this possible?  Using JDBC and SQLite, here's my code.

https://pastebin.com/S8dmaiWz

 

I know the path to the DB is correct, and I know the statement is correct (in fact it's never even hitting the prepared statement because it's throwing the error when it tries to connect to the DB.

 

Ignore my horrible coding practices please

 

 

Link to comment
Share on other sites

Sorry, thanks for the help.

Originally, the error was this,

java.sql.SQLException: No suitable driver found for jdbc:sqlite:/home/john/Desktop/RSDB/rsdb.db

However, after adding a random line of code (new pastebin here = https://pastebin.com/zedjm2qN )

This is the new error.

java.lang.ClassNotFoundException: org.sqlite.JDBC

 

In both cases, I have ensured that the driver is in the build path so.  Is this an osbot thing or am I dumb?t

 

EDIT:

Just tried to execute a python script from inside, and I got this message

Blocked permission: ("java.io.FilePermission" "<<ALL FILES>>" "execute")

 

This leads me to believe that JDBC isn't being blocked by OSbot, which means the alternative.  That I am just dumb.

 

EDIT2:

For any kind soul who is still willing to help, most up to date code https://pastebin.com/Ne4NG3WH

To get rid of the java.lang.ClassNotFound exception, had to change from jdbc 3.16.1 to 3.15.1 or something like that

Still getting the java.sql.SQLException: No suitable driver found for jdbc:sqlite:/home/john/Desktop/RSDB/rsdb.db error though

I guess I'll have to look into the PHP that LoudPacks was suggesting but at the same time plz no

Edited by Smuds
Link to comment
Share on other sites

Real talk hate PHP.  Ended up doing with python.  For anyone interested in the future, here's bare bones what I'm doing.  Haven't really worked in the parameters to enter into the DB but I imagine that's just going to be added on to the URL.

 

script - https://pastebin.com/y1rWUQbA

flask - https://pastebin.com/NSx1eSrB

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...