I understand, but now I open a connection here: Code: Connection connexion; connexion = sqlite.open(); And after, I use the SAME connection object for my statement: Code: PreparedStatement prepare = connexion.prepareStatement("INSERT INTO test(nom, age) VALUES(?, ?)"); So, there is only one object connection... And always the same error Thank you very much for your help
Without meaning any disrespect, it would be much appreciated if you conducted this via PMs since I'd like my notifications on this thread to be about the library itself...
yes I understand, but i think i am not the only one to have problems with this API. And I thought I was allowed to ask help on this thread. Sorry
@blackhatrob: Will do. Yes please, feel free to write any methods and send them to me. I'll work on getting the code on GitHub for commenting, etc. etc. @ Everyone else: Do I have to read all those posts to discover something I fixed in the code, or was it an implementation issue? Also, if I do get this code on GitHub I'll be uploading the test plugin with example code for MySQL and SQLite. Can I add any of these previous posts to it? The thread's purpose is to provide help as well as work on developing the library. Now I haven't read the posts yet, but if it has any good relation to the plugin he should have asked here. Naw, feel free to any time. If it's a very specific issue related to SQL and not the library itself, then resort to another thread or PMs.
Thank you for your answer, but i think my error comes from the library, you don't have methods for INSERT. The method "query" must return a resultset... A new example with the latest version would by very apreciated.
Hi, Is it possible to get a list of the results returning from the database? Something like this returning a list with the results PHP: SELECT * FROM database WHERE world = " + world + "; The coordinates are stored seperatly in the database: X, Y and Z all have a seperate column. Is this possible to get?
Does this library support num rows like mysql_num_rows()? I really need this function. EDIT: I might have created a way to, try this snippet for the guys that need it. Code: public int numRows(ResultSet query) { try { if(sqlite.checkConnection()) { query.last(); int rowCount = query.getRow(); return rowCount; } } catch (SQLException e) { e.printStackTrace(); } return 0; } EDIT2: No, that doesn't work, hoping for a better response.
I have a porblem with SQLite an UPDATE-Query Code: Code: String query5 = "UPDATE unlock SET unlock = 1 ,unlockname = '" + player.getName().toLowerCase() + "' ,unlocktime = '" + plugin.getDateTime() + "' WHERE unlock.id = " + id + ";"; bcguestunlock.sqlite.query(query5); Github When i throw the query the server hang with this message: [SQLite] Error at SQL Query: query does not return ResultSet Same error with other queries without ResultSet like DELETE With the old lib from alta189 and updateQuery it works perfectly Anyone can help?
I've been trying to create a universal method for query() for a while, are you sure it's the most recent version of the library? I tried a trick to stop it from doing this. http://forums.bukkit.org/threads/lib-tut-mysql-sqlite-bukkit-drivers.33849/#post-641927 This is on my list of things to do but I have nowhere near enough time for it right now. As I said above, I've been trying to create a universal query() method just as I made an interface for all databases. I'll try to look into it this weekend and may have to abandon that goal.
Right now it's only in the Javadoc and the examples in the previous pages (look at the bottom of page 1). I'll be working on this a lot more come mid-December.
@ Aleksander Code: public int countRows(ResultSet rs) { int rowCount = 0; try { if (rs == null) return 0; rs.next(); rowCount = rs.getInt(1); rs.close(); } catch (SQLException ex) { Logger.getLogger(MySQL.class.getName()).log(Level.SEVERE, null, ex); } return rowCount; } I use this funtion
Bug to report. Seems that if a query fails, the server crashes without warning. For example: This is the table: Code: [id INTEGER PRIMARY KEY] [TestText text] 1 'test' 2 'Bob' and if I used Code: dbManager.query("SELECT TestText as testvar where TestText = 'Bob'") ** assuming dbManager is an SQLite object. there would be no error and no random crash. However, if I used: Code: dbManager.query("SELECT TestText as testvar where TestText = 'Joseph'") the server crashes without logging or any warning. Maybe it's just my newness to SQL, but I've checked my query and it runs perfectly unless there is no value returned ( value does not exist in table), and then the server crashes. Can anyone confirm?
@Nick Ippoliti I'll look into it when I have free time Nick. Generally I work on this at the same time as my plugin, so if I don't have any time to work on that you know I have no time to work on this.
Thanks. If you thought I sounded demanding, I wasn't trying to be, just giving you a heads up on an issue.
Naw, I love when people give me a heads up. Really? I never knew, thanks Swear. I'll get the next version up on MediaFire and remove the older version at the next opportunity. Are the guidelines posted anywhere?
You can use MediaFire if you want, but I'd rather you use something that allows direct linking. I don't know why this isn't on github, it automatically will package the source into a zip. Perfect for this.
Is the policy because you have to be registered to download attachments? Because if so, I wholeheartedly approve.
Following your 'How to Install' section, I am getting a 'The import lib.PatPeter cannot be resolved' error.
not being mean here, but you can make your own library if you only want to use sqlite you dont have to have sql library study this http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC
Create a folder called 'lib' in the root folder of your plugin/src directory (for Eclipse), followed by a folder called 'PatPeter' inside of the 'lib' folder. Domo, the point of this library is to make a shortcut to that method. Please refrain deflecting users away from this library.
Seems that the server crash is fixed. May have been bukkit updates, or it may have been the try{ statement I added to the SQLite.java. The change is on my plugin's Github page. The change is on line 132. EDIT: seems I have multiple lib folders. The one I am referring to is the one under ~/src/lib/PatPeter/SQLibrary/SQLite.java