September 20, 20187 yr So i'm having problems with connecting to my MS Access database with UcanAccess. I found this snippet on google: // variables Connection connection = null; Statement statement = null; ResultSet resultSet = null; // Step 1: Loading or registering Oracle JDBC driver class try { Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");//Loading Driver } catch(ClassNotFoundException cnfex) { log("Problem in loading or " + "registering MS Access JDBC driver"); cnfex.printStackTrace(); } // Step 2: Opening database connection try { log("TRYING TO CONNECT DB"); String msAccDB = "C:\\Database\\DB1.accdb"; String dbURL = "jdbc:ucanaccess://" + msAccDB; // Step 2.A: Create and get connection using DriverManager class connection = DriverManager.getConnection(dbURL); // Step 2.B: Creating JDBC Statement statement = connection.createStatement(); // Step 2.C: Executing SQL & retrieve data into ResultSet resultSet = statement.executeQuery("SELECT * FROM bots"); // processing returned data and printing into console while(resultSet.next()) { log("DB CONNECTED"); log(resultSet.getInt(1) + "\t" + resultSet.getString(2) + "\t" + resultSet.getString(3) + "\t" + resultSet.getBoolean(4) + "\t" + resultSet.getBoolean(5)); } } catch(SQLException sqlex){ sqlex.printStackTrace(); } But i can't seem to succesfully load the driver, i get this message in the log: [INFO][Bot #1][09/20 10:02:27 PM]: Problem in loading or registering MS Access JDBC driver [INFO][Bot #1][09/20 10:02:27 PM]: TRYING TO CONNECT DB I have the .jar's from UcanAccess. I've tried the following already: - Place the .jar's in the Eclipse workspace. - Place the .jar's in the Eclipse workspace in my package folder. - Imported the .jar's in Eclipse as External jar's. Can't seem to figure this out..
September 20, 20187 yr Author 6 minutes ago, NakedPotato said: I found this helpful when I did it. Does it work with a Access database? I think that method is for mysql db's
September 20, 20187 yr 4 minutes ago, massih said: Does it work with a Access database? I think that method is for mysql db's I actually changed to a mysql db for my project. Unless you really need it to work with an Access db i'd recommend doing the same.
September 20, 20187 yr Author 6 minutes ago, Zummy said: I actually changed to a mysql db for my project. Unless you really need it to work with an Access db i'd recommend doing the same. At this moment that isn't an option for me. There must be some kind of way to get the driver working right?
September 20, 20187 yr 1 minute ago, massih said: At this moment that isn't an option for me. There must be some kind of way to get the driver working right? There is probably a way. It will require lots of rigging I imagine.
September 20, 20187 yr 2 minutes ago, massih said: At this moment that isn't an option for me. There must be some kind of way to get the driver working right? There is always a way! I'm afraid I don't have the proper knowledge to help you out tho, sorry.
September 20, 20187 yr Author 4 minutes ago, HeyImJamie said: JDBC / External libraries are blocked by OSBot. Only for scripts on SDN right? because people with mysql db's also use JDBC
September 20, 20187 yr did you manage to comfobble the mainframe and deltoid the flux capacitor? I did that and it worked.
September 20, 20187 yr Author 22 minutes ago, Knuckolls said: did you manage to comfobble the mainframe and deltoid the flux capacitor? I did that and it worked. I did that for my wireless energy transfering module wich shoots electro beams in to the ionosphere and had my cat work as receiver. It worked then... But didnt work for this. Ly2
September 20, 20187 yr Try following these instructions: Quote I created a folder on my Desktop and put in the following: osbot-sql/ osbot-sql/lib/<YOUR DB CONNECTOR JAR FILE> osbot-sql/lib/OSBot 2.5.8.jar osbot-sql/Start OSBot with SQL Driver.bat The contents of the batch file is as follows: "C:\Program Files\Java\jre1.8.0_172\bin\java.exe" -cp "lib/*" org.osbot.Boot -debug The first bit "C:\...\..\..\" can be changed to just "java" if your running version of Java is compatible with OSBot. Mine isn't. If yours is, then you can simply do the following: java -cp "lib/*" org.osbot.Boot -debug Edited September 20, 20187 yr by liverare
September 21, 20187 yr All direct external connections are blocked by OSBot look into REST APIs. Once your knowledge about them suffices, make a proper REST api . Edited September 21, 20187 yr by Eagle Scripts
September 21, 20187 yr Author 2 hours ago, Eagle Scripts said: All direct external connections are blocked by OSBot look into REST APIs. Once your knowledge about them suffices, make a proper REST api . Thank you sir
Create an account or sign in to comment