![]() I'm not enough of an expert about DatabaseLink, JDBC and SQLite to know whether that is a restriction which could in principle be removed or not. So it seems that either that driver or SQLite in general only support a part of the full JDBC functionality and that DatabaseLink tries to use some of the nonexisting functionality. If one doesn't set Mode -> "ForwardOnly" for SQLResultSetOpen one will see another error message indicating that SQLite only supports forward only. I also tried the preview for the newest version of that driver with the same result. access the JDBC Java object directly or use LibraryLink for direct access to the SQLite C-library - but then one probably is better off to just use the internal functionality.Įdit: I played with this some more and found that even a SQLResultSetOpen will give the same error. Of course there are plenty of other possibilities to access the database nevertheless when bypassing DatabaseLink and e.g. There are also listed some OBDC wrappers in that wiki, which is what you could try as a last resort, but using a bridge cascade like DatabaseLink -> JDBC -> ODBC -> SQLite doesn't sound like a straightforward and reliable solution and I'd not be surprise if that wouldn't work either. Of course there are no guarantees that any of them will work, but if you have the time, you could try them (if you do, I'm sure there users of this site would appreciate if you come back and report). If you need this to work with a JDBC driver and DatabaseLink you might need to find another driver, either another vendor (there is a long list in the sqlite-wiki) or another version. There is even a recipe how you can compile another sqlite library and replace the one that ships with Mathematica here, in case that's of interest (I certainly wouldn't suggest to do that if not for very good reasons). If you don't explicitly need to make access with a JDBC driver and DatabaseLink I'd suggest to just use the internal functionality, which I think is used for internal stuff and is there since version 7 so it might not go away anytime soon (but of course that could happen). To me that looks like some incompatibility of the given JDBC driver for SQLite and what DatabaseLink tries to do with it. On the other hand, the use of the internal functions to access SQLite databases as cormullion has suggested in a comment for the same connection did work alright: db = Database`OpenDatabaseĭatabase`QueryDatabase ![]() There is certainly something going wrong here. One could try to use some more low level approch and accessing the result set directly which can be done using DatabaseLink, but I wouldn't be very optimistic that you can get that working. Just as Stefan, I could then also evaluate SQLTables succesfully but any kind of select does then give the same error that he sees ( "JDBC::error: ResultSet closed."). "jdbc:sqlite:C:\\path\\to\\database.sqlite" (*connection string*) That was all that was necessary to make this succeed: Needs It is basically as easy as putting the jar that you can download into the right directory (It might well be that what Stefan did would also have worked just as well). There is reasonable documentation how you can make JDBC drivers available in the DatabaseLink documentation, which you can find here: JDBC Connections. I'm not sure but don't think the problem is with your setup of the JDBC driver. As Jerome mentioned in his answer since version 10 there is a SQLite JDBC driver coming with DatabaseLink` which is of course the best (and officially supported) way to access SQLite databases in all versions newer than 9. In version 11.1 the Database` functions as described in the original answer following have been removed. If you have any suggestions, I will be very grateful. I am at this point not sure how to proceed /debug the issue and will greatly appreciate any assistance. I used DriverManager.getDrivers() and it shows me that only the driver has been loaded so the error message is justified. ![]() LoadJavaClass Ĭls=Class`forName] ĭriverManager`getConnection I noticed the code uses a Class.forName() and I used the JLinkClassLoader to load the same class. ![]() Ĭonnection = DriverManager.getConnection("jdbc:sqlite:sample.db") The driver
0 Comments
Leave a Reply. |