This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Espen's profile picture

[CC 1.48 - 1.5] ccDB - Connect With Real Databases

Started by Espen, 26 October 2012 - 03:59 PM
Espen #1
Posted 26 October 2012 - 05:59 PM

Interface between ComputerCraft and any DBMS that comes with a JDBC 4 driver.

( Compatible with Xfel's [topic='738']Peripheral Cables[/topic] )


Download Links:
v2.0.2 for CC 1.481 - 1.5 (MC 1.4.6 & MC 1.4.7):
(See bottom of post for older versions)

Changelog:
Spoiler2.0.2
  • Removed ComputerCraft version check in "mcmod.info" (they have conflicting version schemas)
  • Removed "beta" since nobody has reported any errors so far
2.0.1 beta
  • Fixed: Trying to connect the peripheral to a computer with a cable (from Xfel's Peripheral Cables) was causing a crash.
2.0 beta
  • Ported to MC 1.4.6 & MC 1.4.7
  • Namechange from ccMySQL to ccDB
  • Added ability to write to databases (not just read-only like in 1.0) using the update functions.
  • Connection to any DBMS that comes with a JDBC 4 driver.
  • Multiple database connections.
  • Lua-side API 'ccDB' for easy creation and access of connections.
  • Overhaul of internal procedures.


What can I do with it?
[indent=1]Connect to JDBC-capable databases and then execute queries, read and write data, etc. like e.g.:
executeQuery( "SELECT * FROM accounts.users WHERE password = 'secret'" )
getString( "surname" ) -> returns the element at column-label "surname" of the current row as a String
getBoolean( 3 ) -> returns the element at column-index 3 of the current row as a Boolean
updateString( "nickname", "lamarr" )
Or look at the example in the screenshot above! :)/>[/indent]

Recipe: (subject to change, I'm open for suggestions)
[indent=1] OR
Or in ComputerCraft's creative tab.[/indent]



Requirements:
SpoilerYou need these things:
  • This peripheral (download at the top)
  • The JDBC v4 drivers for the DBMSes you want to connect to.
  • Examples:
  • A database to connect to
  • Either an account to a database, or know how to setup your own database.
  • Know SQL or how to educate yourself about it.
  • Read the installation instructions, if you want to know how to install it.
  • Read "Available functions" and "General Usage", if you want to know how to connect to a database and issue commands.

Installation:
  1. Download the necessary JDBC 4 drivers. Each driver should be a .JAR file. Store them to a location of your choice.
  2. Next, if you use a batch file to launch your MC via Minecraft.jar or a launcher where you can add startup-arguments for MC:
  3. Put the .JAR file into a directory of your choosing (but not the mods folder). Then add this to your MC startup arguments:
    -Djdbc.drivers=com.mysql.jdbc.Driver -Xbootclasspath/a:C:\\mysql-connector-java-5.1.22-bin.jar
    Obviously, change com.mysql.jdbc.Driver to the package name of the JDBC driver you're using (see installation docs of the respective driver). Also change C:\\mysql-connector-java-5.1.22-bin.jar to the path and name you've stored your JDBC .JAR file. To load multiple drivers, separate them with a colon, like this: -Djdbc.drivers=com.mysql.jdbc.Driver:org.postgresql.Driver Also add the location of each JDBC driver as a separate -Xbootclasspath/a:LOCATION, where LOCATION is the absolute path to the respective driver. Lastly, keep in mind that the java command line parameters are case-sensitive!
    • As an easier alternative, simply put the .JAR driver file into your Minecraft's mods folder.
    • If you are on Windows, then it should be %appdata%\.minecraft\mods\ I recommend doing it the former way though, as that loads the drivers together with Minecraft instead of having Forge inject them during the mod loading process.
  4. Download this peripheral, it's a .ZIP file. Don't extract it, simply put it into the mods folder as well.
  5. Done :)/>

Available functions:
SpoilerIt essentially works like the Java-methods of the java.sql package, with the exception of as few methods which I had to customize in order to make them work with ComputerCraft's Lua.

Lua API Methods:
ccDB.getNewConnection( url, user, password ) - Establishes a new database connection. Returns a table through which all functions of the connection can be accessed.
ccDB.disconnectAll( )
- Disconnects all database connections.
ccDB.getVersion( ) - Returns the peripheral version as a string.
ccDB.getDebug( )
- Returns true if debug mode is enabled; false otherwise. (default = false)
ccDB.setDebug( true/false ) - Enables debug mode, which prints stack traces (very detailed error messages) to the Forge logfile.


The rest of these functions are available for each created connection-object. Since a connection-object is a lua table, call these functions via a colon, like e.g. myDB:disconnect(), where "myDB" is the connection-object and "disconnect()" one of the following methods.

Database-Object Methods:
These methods are available after a query has been executed.
Since they are essentially direct mappings of their Java counterparts, I refer you to the official javadocs, which contain a list of the available methods:
Java API - ResultSet
Java API - ResultSetMetaData
From these lists, the following methods are not (yet) supported:
Spoiler
  • clearWarnings
  • close
  • getArray
  • getAsciiStream
  • getBigDecimal
  • getBinaryStream
  • getBlob
  • getByte
  • getBytes
  • getCharacterStream
  • getClob
  • getMetaData - Redundant, since I already included its functions directly.
  • getNCharacterStream
  • getNClob
  • getObject
  • getRef
  • getRowId
  • getSQLXML
  • getStatement
  • getTimestamp
  • getURL
  • getUnicodeStream
  • getWarnings
  • isClosed
  • rowUpdated
  • updateArray
  • updateAsciiStream
  • updateBigDecimal
  • updateBinaryStream
  • updateBlob
  • updateByte
  • updateBytes
  • updateCharacterStream
  • updateClob
  • updateNCharacterStream
  • updateNClob
  • updateObject
  • updateRef
  • updateRowId
  • updateSQLXML
  • updateTimestamp
  • getColumnClassName

Customized methods:
updateLong( columnIndex, longValue ) - Works like its Java equivalent, except that it expects 'longValue' to be a string containing the long value.
updateLong( columnLabel, longValue ) - Works like its Java equivalent, except that it expects 'longValue' to be a string containing the long value.

getDate( columnIndex ) - Works like its Java equivalent, except that it returns a string with the date in yyyy-mm-dd format.
getDate( columnLabel ) - Works like its Java equivalent, except that it returns a string with the date in yyyy-mm-dd format.
getDateMS( columnIndex ) - Works like its Java equivalent, except that it returns the date in milliseconds since January 1st 1970.
getDateMS( columnLabel ) - Works like its Java equivalent, except that it returns the date in milliseconds since January 1st 1970.
updateDate( columnIndex, date ) - Works like its Java equivalent, except that it expects 'date' to be a string with milliseconds since January 1st 1970.
updateDate( columnLabel, date ) - Works like its Java equivalent, except that it expects 'date' to be a string with milliseconds since January 1st 1970.

getTime( columnIndex ) - Works like its Java equivalent, except that it returns a string with the time in hh:mm:ss format.
getTime( columnLabel ) - Works like its Java equivalent, except that it returns a string with the date in hh:mm:ss format.
getTimeMS( columnIndex ) - Works like its Java equivalent, except that it returns the time in milliseconds.
getTimeMS( columnLabel ) - Works like its Java equivalent, except that it returns the time in milliseconds.
updateTime( columnIndex, time ) - Works like its Java equivalent, except that it expects 'time' to be a string with milliseconds.
updateTime( columnLabel, time ) - Works like its Java equivalent, except that it expects 'time' to be a string with milliseconds.


Additional methods:
getRowCount( ) - Returns the amount of rows contained within a ResultSet.
getRowElements( ) - Returns all elements in the current row as a string-table. (N.B.: Determine the amount of elements with getColumnCount.)
executeQuery( sql ) - Executes the SQL statement (string), which creates a ResultSet per connection, i.e. overwrites the connection's old ResultSet everytime a new query is executed.
disconnect( ) - Disconnects the database connection on which it was called.

General usage:
SpoilerFor a quick example, take a look at the screenshot above. It shows the table of a database and in the background some in-game commands on that table.
Generally, you'd go about it like this (requires a database & a valid user account!):
  1. Place down the Connector Block next to the computer you want to use it with.
  2. Turn on or restart the computer.
  3. Make sure the ccDB API has been loaded (The variable 'ccDB' should exist as a table).
  4. Create a database connection:
  5. db = ccDB.connect( "jdbc:mysql://localhost:3306", "admin", "secretpassword" )
    For MySQL JDBC the addresses to the server always begin with jdbc:mysql:// followed by the server's HOSTNAME or IP address, in this example localhost. This is followed by a colon, after which you enter the port of the server. Since 3306 is the default you could just as well leave it out though (as shown in the next example). The next two strings are the username and password with which you want to connect to the server. Note that you could already choose a specific database to connect to on the MySQL-Server simply by putting its name after the URL like this:
    db = ccDB.connect( "jdbc:mysql://localhost/accounts", "admin", "secretpassword" )
    This way you wouldn't need to enter, for example, accounts.articles for every SQL statement but simply articles. For PostgreSQL the connection string starts like this:
    jdbc:postgresql://
    In any case though: Refer to the documentation of the specific JDBC driver you're using in order to find out the required connection string!
  6. Ok, now we're all setup and can finally execute a query on the connection we've just established:
  7. db:executeQuery( "SELECT * FROM accounts.articles" )
    …where accounts would be the database and articles the table you want to access on the MySQL-Server. If the query was successful (indicated both by text-output and events), then a ResultSet will have been created which contains all of the results in table form. Also notice that I used a colon to call the function. All functions of a connection-object are accessed with a colon, NOT with a dot! Only the API functions of ccDB are called with a dot.
  8. Now you can call any of the listed ResultSet and MetaData functions (See 'Available Functions') to access content from the ResultSet (i.e. the results of the query), like e.g.:
  9. db:getString("lastname")
    This would return the content of column "lastname" of the current row as a string.
  10. If you want to fire off another query, goto step 5.
  11. This will overwrite your current ResultSet with a new one.
  12. If you're all done and want to close this connection, type:
  13. db:disconnect()
    You can also close all connections by either typing…
    ccDB.disconnectAll()
    … or rebooting / shutting down the computer, or by destroying the Connector-Block.

Bugs:
SpoilerI've been only able to test it in a very small-scale way, so there might be some bugs or oversights I haven't yet encountered and therefore wasn't able to account for.
If think you found a bug and want to report it, then please make sure to include instructions for how to reproduce it!
What helps a lot is if you turn on the debug mode, so that a stack trace of all errors will be printed to the Forge log file.
You can activate the debug mode in-game once connected to the peripheral via setDebug( true )
The Forge log file with the latest log-entries is always ForgeModLoader-*-0.log which you'll find in your .minecraft folder.




Plans for the future:
SpoilerI'm planning on releasing the source-code, but not until the code is…
  • cleaned-up
  • 'settled', i.e. relatively bug-free and no major changes in sight
  • properly documented
Apart from that:
  • A video demonstrating some simple examples (heavily depends on my free time).
  • An example program, showing a possible use-case. ( A basic entrance access control with an in-game Server-Client architecture )
  • "Maybe": Ability to hold multiple ResultSets, not just one.
  • "Maybe": Ability to set up prepared statements. (Not sure if this is really needed though.)
  • A Bukkit-Version - Not planned (yet). Maybe at the end of may (2013) when I'm through with my exams.

"[acronym='Trololo']License[/acronym]":
SpoilerWTFPL
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.

That being said, it's always nice to be asked for permission or at least given a notice, solely because I'm curious to see what other people create.
Also it always feels much nicer not to be plagiarized for all the hard work one has put into this, as I guess anyone who ever created something can relate to.

Basically: Do WTF you want, just don't be a dick, k? ^_^/>


Have fun! :)/>

Cheers,
Espen

Old versions (not supported):
Spoilerv2.0.1 beta for CC 1.481+ : Dropbox
v2.0 beta for CC 1.46+ : Dropbox

This version only supports reading from MySQL databases. No writing, no other DBMS.
v1.0 alpha for CC 1.47 : Dropbox
v1.0 alpha for CC 1.46 : Dropbox
v1.0 alpha for CC 1.42 - 1.45 : Dropbox
Compatible with [topic='738']Xfel's Peripheral Cables[/topic] v1.1.2 - 1.2.1
Edited on 28 March 2013 - 05:09 AM
Tiin57 #2
Posted 26 October 2012 - 06:01 PM
Excellent work!
bbqroast #3
Posted 28 October 2012 - 02:11 AM
Could it be possible to use variables for holding connections?

So you could do soemthing like this:

a, b = mysql_connect("localhost","bbqroast","epicpassword")
c, d = mysql_connect("192.41.3.32","user","pass")
if a == true then
  e, f = mysql_select_db("database1", a)
  if e == true then
   // do stuff
  end
  g, h = mysql_select_db("database1", a)
  if g == true then
   // do stuff
  end
  end
end
Basically the mysql connect and select DB functions return "handles" which are then used by the other functions. This way you can open as many connections as you want. This also adds an extra layer of security, as the handle must be used to connect to the database. I imagine the handles could just be integers which Java has lined up to actual connections (no need for LUA to handle anything more intensive).
Tiin57 #4
Posted 28 October 2012 - 10:49 AM
Could it be possible to use variables for holding connections?

So you could do soemthing like this:

a, b = mysql_connect("localhost","bbqroast","epicpassword")
c, d = mysql_connect("192.41.3.32","user","pass")
if a == true then
  e, f = mysql_select_db("database1", a)
  if e == true then
   // do stuff
  end
  g, h = mysql_select_db("database1", a)
  if g == true then
   // do stuff
  end
  end
end
Basically the mysql connect and select DB functions return "handles" which are then used by the other functions. This way you can open as many connections as you want. This also adds an extra layer of security, as the handle must be used to connect to the database. I imagine the handles could just be integers which Java has lined up to actual connections (no need for LUA to handle anything more intensive).
I have no idea.
However, just need to point something out. Doing
 if x == true then end 
is always unnecessary. Just do
 if x then end 
Espen #5
Posted 28 October 2012 - 01:40 PM
Could it be possible to use variables for holding connections?
[…]

That would definitely be a possibility. I planned something similar for SQL statements, because I thought that opening too many connections would be a waste when you could just provide a statement-object per user that runs on the same connection. Admittedly though they would all run within the same user-context of this one connection and I would have to add an extra layer of access control via Java which - come to think of it - is really unnecessary.
Why reinvent the wheel when the database server already has built-in functionality for this, right?

So yeah, definitely something I'll put on my todo-list, as this makes much more sense.
Unfortunately I catched a cold, so at the moment I'm a bit incapacitated. But as soon as I'm better (1-2 days), I'll put this in the next version.

Thanks for the suggestion, very much appreciated!
If you have any other suggestions, ideas or questions, don't hesitate to ask. That's exactly the reason why this is in alpha. :D/>/>

EDIT: Updated OP accordingly.
Edited on 28 October 2012 - 12:49 PM
MaHuJa #6
Posted 05 November 2012 - 01:31 PM
However, just need to point something out. Doing
 if x == true then end 
is always unnecessary. Just do
 if x then end 


> = "text"==true
false
> = "text"==false
false

If you have any other suggestions, ideas or questions, don't hesitate to ask. That's exactly the reason why this is in alpha. :D/>/>

Can you, provided the appropriate jdbc drivers are installed, access other databases as well? Postgres in particular.
There's just so much wrong about mysql that I've stopped using it, and neither do I have the tools for it anymore.
Espen #7
Posted 06 November 2012 - 09:15 AM
Can you, provided the appropriate jdbc drivers are installed, access other databases as well? Postgres in particular.
There's just so much wrong about mysql that I've stopped using it, and neither do I have the tools for it anymore.

For the alpha version the plan was to develop exclusively with MySQL in mind. This way I can focus on getting it to work on at least one DBMS first.
Also I'm most experienced with MySQL compared to other DBMSes. But that's about to change due to my new courses this semester. :P/>/>
Having said that, I made sure from the beginning to not use MySQL-specific code, but to use the general java sql API only.
The only "hard-coded" part is where I explicitly initialize the MySQL driver ("com.mysql.jdbc.Driver"). But I only did that for legacy purposes, i.e. it is necessary for JDBC versions below 4.0.

So in theory then, it should be possible to use it with another DBMS (since I only used the java.sql API), but I haven't tested that yet.
At the moment I'm overhauling the way connections and statements are created &amp; handled in order to allow a more dynamic use of multiple connections.
Once I've got that working well enough I'll start focusing on testing it with other drivers/DBMSes.

Cheers :D/>/>
sirdabalot #8
Posted 23 November 2012 - 01:02 PM
Hi, I'm getting this error:

Spoiler

java.lang.NoClassDefFoundError: espen/ccMySQL/connectorBlock/BlockMySQLConnector
    at espen.ccMySQL.shared.ccMySQLProxyCommon.registerBlocks(ccMySQLProxyCommon.java:27)
    at espen.ccMySQL.shared.ccMySQLProxyCommon.load(ccMySQLProxyCommon.java:16)
    at espen.ccMySQL.server.ccMySQLProxyServer.load(ccMySQLProxyServer.java:9)
    at espen.ccMySQL.client.ccMySQLProxyClient.load(ccMySQLProxyClient.java:14)
    at espen.ccMySQL.ccMySQL.load(ccMySQL.java:83)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:440)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
    at com.google.common.eventbus.EventBus.post(EventBus.java:268)
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
    at com.google.common.eventbus.EventBus.post(EventBus.java:268)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
    at cpw.mods.fml.common.Loader.initializeMods(Loader.java:651)
    at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:197)
    at net.minecraft.client.Minecraft.a(Minecraft.java:469)
    at net.minecraft.client.Minecraft.run(Minecraft.java:756)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: espen.ccMySQL.connectorBlock.BlockMySQLConnector
    at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:141)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 34 more
Caused by: java.lang.IncompatibleClassChangeError: class espen.ccMySQL.connectorBlock.BlockMySQLConnector has interface aiq as super class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:134)
    ... 36 more
2012-11-23 00:00:54 [INFO] [STDERR] cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: espen/ccMySQL/connectorBlock/BlockMySQLConnector
2012-11-23 00:00:54 [INFO] [STDERR]	 at cpw.mods.fml.common.LoadController.transition(LoadController.java:117)
2012-11-23 00:00:54 [INFO] [STDERR]	 at cpw.mods.fml.common.Loader.initializeMods(Loader.java:652)
2012-11-23 00:00:54 [INFO] [STDERR]	 at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:197)
2012-11-23 00:00:54 [INFO] [STDERR]	 at net.minecraft.client.Minecraft.a(Minecraft.java:469)
2012-11-23 00:00:54 [INFO] [STDERR]	 at net.minecraft.client.Minecraft.run(Minecraft.java:756)
2012-11-23 00:00:54 [INFO] [STDERR]	 at java.lang.Thread.run(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR] Caused by: java.lang.NoClassDefFoundError: espen/ccMySQL/connectorBlock/BlockMySQLConnector
2012-11-23 00:00:54 [INFO] [STDERR]	 at espen.ccMySQL.shared.ccMySQLProxyCommon.registerBlocks(ccMySQLProxyCommon.java:27)
2012-11-23 00:00:54 [INFO] [STDERR]	 at espen.ccMySQL.shared.ccMySQLProxyCommon.load(ccMySQLProxyCommon.java:16)
2012-11-23 00:00:54 [INFO] [STDERR]	 at espen.ccMySQL.server.ccMySQLProxyServer.load(ccMySQLProxyServer.java:9)
2012-11-23 00:00:54 [INFO] [STDERR]	 at espen.ccMySQL.client.ccMySQLProxyClient.load(ccMySQLProxyClient.java:14)
2012-11-23 00:00:54 [INFO] [STDERR]	 at espen.ccMySQL.ccMySQL.load(ccMySQL.java:83)
2012-11-23 00:00:54 [INFO] [STDERR]	 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2012-11-23 00:00:54 [INFO] [STDERR]	 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at java.lang.reflect.Method.invoke(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:440)
2012-11-23 00:00:54 [INFO] [STDERR]	 at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at java.lang.reflect.Method.invoke(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
2012-11-23 00:00:54 [INFO] [STDERR]	 at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2012-11-23 00:00:54 [INFO] [STDERR]	 at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
2012-11-23 00:00:54 [INFO] [STDERR]	 at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
2012-11-23 00:00:54 [INFO] [STDERR]	 at com.google.common.eventbus.EventBus.post(EventBus.java:268)
2012-11-23 00:00:54 [INFO] [STDERR]	 at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
2012-11-23 00:00:54 [INFO] [STDERR]	 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2012-11-23 00:00:54 [INFO] [STDERR]	 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at java.lang.reflect.Method.invoke(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
2012-11-23 00:00:54 [INFO] [STDERR]	 at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2012-11-23 00:00:54 [INFO] [STDERR]	 at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
2012-11-23 00:00:54 [INFO] [STDERR]	 at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
2012-11-23 00:00:54 [INFO] [STDERR]	 at com.google.common.eventbus.EventBus.post(EventBus.java:268)
2012-11-23 00:00:54 [INFO] [STDERR]	 at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
2012-11-23 00:00:54 [INFO] [STDERR]	 at cpw.mods.fml.common.Loader.initializeMods(Loader.java:651)
2012-11-23 00:00:54 [INFO] [STDERR]	 ... 4 more
2012-11-23 00:00:54 [INFO] [STDERR] Caused by: java.lang.ClassNotFoundException: espen.ccMySQL.connectorBlock.BlockMySQLConnector
2012-11-23 00:00:54 [INFO] [STDERR]	 at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:141)
2012-11-23 00:00:54 [INFO] [STDERR]	 at java.lang.ClassLoader.loadClass(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at java.lang.ClassLoader.loadClass(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 ... 34 more
2012-11-23 00:00:54 [INFO] [STDERR] Caused by: java.lang.IncompatibleClassChangeError: class espen.ccMySQL.connectorBlock.BlockMySQLConnector has interface aiq as super class
2012-11-23 00:00:54 [INFO] [STDERR]	 at java.lang.ClassLoader.defineClass1(Native Method)
2012-11-23 00:00:54 [INFO] [STDERR]	 at java.lang.ClassLoader.defineClass(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at java.lang.ClassLoader.defineClass(Unknown Source)
2012-11-23 00:00:54 [INFO] [STDERR]	 at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:134)
2012-11-23 00:00:54 [INFO] [STDERR]	 ... 36 more

Could you tell me what I've done wrong this time? ;)/>/> I think I installed all the prerequisites correctly…
Espen #9
Posted 23 November 2012 - 03:17 PM
Hmm, it looks like Minecraft can't find the class. May I ask what CC version you're using?
And did you extract the .zip into the mods-folder or put it in there without extracting?

I'm not sure, but if you're using 1.47 then I might have to recompile for that.
For some reason I was under the impression the obfuscation didn't change, but I might've been wrong about that.
I'll do that in a few hours, but now I have to go to bed as it's almost in the morning and I can't think straight anymore.^^

I'll report back as soon as I got some shuteye. Cu! ;)/>/>
sirdabalot #10
Posted 23 November 2012 - 11:29 PM
-Snip-

Thanks for the reply, I am using CC 1.47 and didn't extract the zip, however I did use magic launcher to add the mod but also tried the mod folder option and both gave me the same error. ;)/>/>
Espen #11
Posted 24 November 2012 - 03:46 AM
Ok, I was mistaken about the MCP changes. I remember having read that CC didn't need to do much for an update because the obfuscation didn't change and somehow I falsely remembered that to be the case for the update to MC 1.4.4
But as it turns out it was the update to MC 1.4.5 that didn't have an obfuscation change, whereas there actually was one from MC 1.4.2 to 1.4.4

To make it short: I just updated the OP by adding a download-link for CC 1.47 that should work with both MC 1.4.4 and 1.4.5 -_-/>/>
I also changed the install-instructions a bit to show an alternative way for how to install the JDBC driver(s).

Regarding the progress of the mod:
Since the first release I've been working on the mod, it's just that I follow a work-in-secret-until-it's-done work ethic.^^
But I am still working on it! Not every day, as I have other projects going on + exams I have to learn for. But it's progressing steadily.

Currently I've managed to support any database managment systems for which JDBC drivers exist. So it's not a MySQL-only deal anymore.
I've also had success with making it possible to create multiple connections ingame, which was actually a lot trickier than I anticipated.
But it works and now I just have to streamline the process for the end-user from within CC.

There's still some restructuring I need to do, but I'm progressing at a good pace.
When I'm done there might be a namechange to "ccDB" or similar to account for the fact that it's not limited to MySQL-only anymore.
But first I have to finish the current TODO's and make it pwetty. ;)/>/>
jsom #12
Posted 25 November 2012 - 02:59 AM
Excellent work!
need a simple example of how to use ResultSet, print on the monitor  or something similar.
I have successfully connected to the database and stuck)
Espen #13
Posted 25 November 2012 - 04:39 AM
Excellent work!
need a simple example of how to use ResultSet, print on the monitor  or something similar.
I have successfully connected to the database and stuck)
Let's say the database table 'persons' has this structure:
ID - firstname - lastname - age - nickname - city - country

And let's further assume, that there are the following rows for that structure:
0 - Peter - Parker - 25 - spidey - Arachnopolis - Fantasyland
1 - Jenny - Carsson - 17 - bluebird - Seattle - USA
2 - Sherlock - Holmes - 35 - magnyfire - London - UK

Then the following code…
Spoiler
local city
local firstname
local lastname
local nickname
local age
local db

-- Connect to peripheral
db = peripheral.wrap( "top" )
-- Connect to database
db.connect( "jdbc:mysql://localhost/accounts", "admin", "secretpassword" )

-- Execute a query on the database
db.executeQuery( "SELECT * FROM persons" )

for i = 1, db.getNumRows() do
  -- Set the pointer to the next position in the result set.
  db.next()

  -- Pulling values from the database at the current pointer position.
  -- Note that we can access values either by their column-labels or their column-IDs.
  city      = db.getString(5)
  firstname = db.getString("firstname")
  lastname  = db.getString(2)
  nickname  = db.getString("nickname")
  age       = db.getInt("age")

  print( "Person #" .. i)
  print( "============================" )
  print( "First Name: " .. firstname )
  print( "Last Name: " .. lastname )
  print( "Nickname: " .. nickname )
  print( "Age: " .. age )
  print( "City: " .. city )
  print()
end

-- Close connection
db.disconnect()

… should output this:
Person #1
============================
First Name: Peter
Last Name: Parker
Nickname: spidey
Age: 25
City: Arachnopolis

Person #2
============================
First Name: Jenny
Last Name: Carsson
Nickname: bluebird
Age: 17
City: Seattle

Person #3
============================
First Name: Sherlock
Last Name: Holmes
Nickname: magnyfire
Age: 35
City: London
infchem #14
Posted 27 November 2012 - 08:40 AM
Great job.
But…..could you downgrade it to CC 1.4.1?

Greetings,
infchem
Espen #15
Posted 27 November 2012 - 09:27 AM
@infchem:
That should be no problem, as it doesn't seem there were any major changes regarding the peripheral API since that CC version that would have any on this mod.
Have to get the MCP for MC1.2.5 and recompile which should be pretty straightforard.
I'm about to go out for a few hours, but as soon as I'm back I'll do it
infchem #16
Posted 27 November 2012 - 09:35 AM
Thanks for your time!

I'll use your mod with my students in highschool for teaching computer science.
For motivational reasons i choose minecraft as the programming environment :)/>
Espen #17
Posted 27 November 2012 - 11:03 AM
Thanks for your time!

I'll use your mod with my students in highschool for teaching computer science.
For motivational reasons i choose minecraft as the programming environment :)/>
Oh wow, didn't expect that to happen.^^
But you are aware that the alpha version can only read form the database? No offense, just checking. Don't want you to find out during your class.
I am currently working on the next version which will allow manipulation as well, along with being able to connect to other DBMS than MySQL.
And the way connections are being created from within CC will undergo a little change to accomodate multiple DB server connections.

I can't really say how much longer it will take, but a rough estimate would be sometime next week, depending on my motivation and RL stuff.
But if you're gonna use this in class, then I feel inclined to put a bit more time into it and make the code nice and tidy. ^_^/>

EDIT:
I spoke too soon. That is, about it being pretty straightforward to downgrade the mod to MC 1.2.5 -_-/>
Didn't think of Forge and its changes since 1.2.5. Ergo I'm gonna have to make a bunch of code changes to accomodate for these changes, or the mod won't compile. So it won't be that easy after all. Just wanted to let you know.^^
Edited on 27 November 2012 - 10:40 AM
KaoS #18
Posted 27 November 2012 - 12:50 PM
nice innovation there :)/> I did not see the peripheral block coming; I must admit it is a great way of preventing global communication hacks
sirdabalot #19
Posted 02 December 2012 - 12:19 AM
Thanks for your time!

I'll use your mod with my students in highschool for teaching computer science.
For motivational reasons i choose minecraft as the programming environment :)/>

Every day, my old highscool seems to get crapper and crapper… :(/>
infchem #20
Posted 18 December 2012 - 09:51 AM
Sorry for the delay. I'll try to work with CC 1.4.7 and CCLan instead of Redpower, so I don't need an older mc. I evaluate your block on thursday ^_^/>
Espen #21
Posted 30 December 2012 - 05:13 AM
[strike]Here's an updated version for MC 1.4.6
Needs at least ComputerCraft v1.481

Haven't tested it extensively yet, so I'm holding off on updating the OP.
Here you go: [attachment=837:ccMySQL_1.0.0_mc1.4.6.zip][/strike]

EDIT: Obsolete, get the latest ccDB on the OP now. :)/>
Edited on 20 January 2013 - 12:09 AM
iownall555 #22
Posted 30 December 2012 - 04:06 PM
Hmm I think the connector id is conflicting with one of the turtle ids.

SpoilerMinecraft has crashed!
———————-

Minecraft has stopped running because it encountered a problem; Failed to start game

A full error report has been saved to C:\Users\Andrew Hall\AppData\Roaming\.minecraft\crash-reports\crash-2012-12-30_14.05.25-client.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash :(/>



— BEGIN ERROR REPORT 9988a3fc ——–
Full report at:
C:\Users\Andrew Hall\AppData\Roaming\.minecraft\crash-reports\crash-2012-12-30_14.05.25-client.txt
Please show that file to Mojang, NOT just this screen!

Generated 30/12/12 2:05 PM

– System Details –
Details:
Minecraft Version: 1.4.6
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_10, Oracle Corporation
Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 429914400 bytes (409 MB) / 514523136 bytes (490 MB) up to 954466304 bytes (910 MB)
JVM Flags: 2 total; -Xms512m -Xmx1024m
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.25 FML v4.6.12.511 Minecraft Forge 6.5.0.471 25 mods loaded, 25 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
mod_TooManyItems [mod_TooManyItems] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Core [BuildCraft] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Builders [BC Builders] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Energy [BC Energy] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Factory [BC Factory] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Transport [BC Transport] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Silicon [BC Silicon] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
ComputerCraft [ComputerCraft] (ComputerCraft) Unloaded->Constructed->Pre-initialized->Initialized
CCCable [ComputerCraft Peripheral Cables] (cccable-1.3.0-universal.zip) Unloaded->Constructed->Pre-initialized->Initialized
ccMySQL [ccMySQL - A peripheral for ComputerCraft] (ccMySQL_1.0.0_mc1.4.6.zip) Unloaded->Constructed->Pre-initialized->Initialized
CCTurtle [ComputerCraft Turtles] (ComputerCraft) Unloaded->Constructed->Pre-initialized->Errored
ImmibisCore [Immibis Core] (immibis-core-52.1.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
ImmibisPeripherals [Immibis's Peripherals] (immibis-peripherals-52.0.6.jar) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerCore [RedPower] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerBase [RP Base] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerMachine [RP Machine] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerCompat [RP Compat] (RedPowerCompat-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerWiring [RP Wiring] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerLogic [RP Logic] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerLighting [RP Lighting] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerWorld [RP World] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerControl [RP Control] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
LWJGL: 2.4.2
OpenGL: GeForce GTS 450/PCIe/SSE2 GL version 4.2.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'forge,fml'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null

java.lang.IllegalArgumentException: Slot 4093 is already occupied by espen.ccmysql.connectorBlock.BlockMySQLConnector@1720d4d7 when adding dan200.turtle.shared.BlockTurtle@6c757b1d
at amq.<init>(Block.java:324)
at akb.<init>(BlockContainer.java:11)
at dan200.computer.shared.BlockComputerBase.<init>(BlockComputerBase.java:30)
at dan200.turtle.shared.BlockTurtle.<init>(BlockTurtle.java:28)
at dan200.turtle.shared.CCTurtleProxyCommon.registerItems(CCTurtleProxyCommon.java:278)
at dan200.turtle.shared.CCTurtleProxyCommon.load(CCTurtleProxyCommon.java:55)
at dan200.turtle.client.CCTurtleProxyClient.load(CCTurtleProxyClient.java:47)
at dan200.CCTurtle.load(CCTurtle.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:478)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:656)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207)
at net.minecraft.client.Minecraft.a(Minecraft.java:456)
at asq.a(SourceFile:56)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Thread.java:722)
— END ERROR REPORT db0394bf ———-

The other peripheral mods I have installed are ccCable and Immibis Peripherals. I'll try a different block id.
Espen #23
Posted 30 December 2012 - 04:09 PM
Hmm I think the connector id is conflicting with one of the turtle ids.

SpoilerMinecraft has crashed!
———————-

Minecraft has stopped running because it encountered a problem; Failed to start game

A full error report has been saved to C:\Users\Andrew Hall\AppData\Roaming\.minecraft\crash-reports\crash-2012-12-30_14.05.25-client.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash :(/>



— BEGIN ERROR REPORT 9988a3fc ——–
Full report at:
C:\Users\Andrew Hall\AppData\Roaming\.minecraft\crash-reports\crash-2012-12-30_14.05.25-client.txt
Please show that file to Mojang, NOT just this screen!

Generated 30/12/12 2:05 PM

– System Details –
Details:
Minecraft Version: 1.4.6
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_10, Oracle Corporation
Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 429914400 bytes (409 MB) / 514523136 bytes (490 MB) up to 954466304 bytes (910 MB)
JVM Flags: 2 total; -Xms512m -Xmx1024m
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.25 FML v4.6.12.511 Minecraft Forge 6.5.0.471 25 mods loaded, 25 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
mod_TooManyItems [mod_TooManyItems] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Core [BuildCraft] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Builders [BC Builders] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Energy [BC Energy] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Factory [BC Factory] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Transport [BC Transport] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
BuildCraft|Silicon [BC Silicon] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
ComputerCraft [ComputerCraft] (ComputerCraft) Unloaded->Constructed->Pre-initialized->Initialized
CCCable [ComputerCraft Peripheral Cables] (cccable-1.3.0-universal.zip) Unloaded->Constructed->Pre-initialized->Initialized
ccMySQL [ccMySQL - A peripheral for ComputerCraft] (ccMySQL_1.0.0_mc1.4.6.zip) Unloaded->Constructed->Pre-initialized->Initialized
CCTurtle [ComputerCraft Turtles] (ComputerCraft) Unloaded->Constructed->Pre-initialized->Errored
ImmibisCore [Immibis Core] (immibis-core-52.1.0.jar) Unloaded->Constructed->Pre-initialized->Initialized
ImmibisPeripherals [Immibis's Peripherals] (immibis-peripherals-52.0.6.jar) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerCore [RedPower] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerBase [RP Base] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerMachine [RP Machine] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerCompat [RP Compat] (RedPowerCompat-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerWiring [RP Wiring] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerLogic [RP Logic] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerLighting [RP Lighting] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerWorld [RP World] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
RedPowerControl [RP Control] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized
LWJGL: 2.4.2
OpenGL: GeForce GTS 450/PCIe/SSE2 GL version 4.2.0, NVIDIA Corporation
Is Modded: Definitely; Client brand changed to 'forge,fml'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: ~~ERROR~~ NullPointerException: null

java.lang.IllegalArgumentException: Slot 4093 is already occupied by espen.ccmysql.connectorBlock.BlockMySQLConnector@1720d4d7 when adding dan200.turtle.shared.BlockTurtle@6c757b1d
at amq.<init>(Block.java:324)
at akb.<init>(BlockContainer.java:11)
at dan200.computer.shared.BlockComputerBase.<init>(BlockComputerBase.java:30)
at dan200.turtle.shared.BlockTurtle.<init>(BlockTurtle.java:28)
at dan200.turtle.shared.CCTurtleProxyCommon.registerItems(CCTurtleProxyCommon.java:278)
at dan200.turtle.shared.CCTurtleProxyCommon.load(CCTurtleProxyCommon.java:55)
at dan200.turtle.client.CCTurtleProxyClient.load(CCTurtleProxyClient.java:47)
at dan200.CCTurtle.load(CCTurtle.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:478)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:656)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207)
at net.minecraft.client.Minecraft.a(Minecraft.java:456)
at asq.a(SourceFile:56)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Thread.java:722)
— END ERROR REPORT db0394bf ———-

The other peripheral mods I have installed are ccCable and Immibis Peripherals. I'll try a different block id.
Yeah, if you re-use the config from the old version, then you have to change the ID. Either for this block, or for the turtle block.
iownall555 #24
Posted 30 December 2012 - 04:14 PM
To be honest, this is the first time I've used this mod. Nonetheless I've gotten it to work. It does look really promising though.
Espen #25
Posted 30 December 2012 - 04:36 PM
Nice to hear you got it working. If you have any problems let me know.
Might be a few hours before I answer though, as it's almost 5 in the morning here and I really have to get some quality sleep. ^_^/>
hach-que #26
Posted 02 January 2013 - 08:26 PM
Hi, is there source code available for this? I'd like to port it to PostgreSQL and add update / insert functionality.
Espen #27
Posted 02 January 2013 - 11:00 PM
Hi, is there source code available for this? I'd like to port it to PostgreSQL and add update / insert functionality.
Not at the moment, but I'm planning to as soon as I'm done with the next version and have cleaned up the code somewhat (it's an experimental mess right now).
The next version will include the possibility of connecting to any DBMS with JDBC support, not just MySQL.
That also includes PostgreSQL (Coincidentally I've been testing with that one as well). ^_^/>

I'm making good progress, multiple connections are working now, as well as general DBMS support.
What I'm working at now is to make work with SMP in a sensible way.

After that, the next thing on the list is adding functions for writing/manipulating data (because at the moment I've only included the possibility to read from the database).
unstopablekk #28
Posted 13 January 2013 - 05:13 PM

---- Minecraft Crash Report ----
// Don't be sad. I'll do better next time, I promise!
Time: 1/12/13 10:59 PM
Description: Failed to start game
cpw.mods.fml.common.LoaderException: java.lang.NoClassDefFoundError: espen/ccMySQL/connectorBlock/BlockMySQLConnector
at cpw.mods.fml.common.LoadController.transition(LoadController.java:117)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:658)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207)
at net.minecraft.client.Minecraft.a(Minecraft.java:456)
at asq.a(SourceFile:56)
at net.minecraft.client.Minecraft.run(Minecraft.java:744)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: espen/ccMySQL/connectorBlock/BlockMySQLConnector
at espen.ccMySQL.shared.ccMySQLProxyCommon.registerBlocks(ccMySQLProxyCommon.java:27)
at espen.ccMySQL.shared.ccMySQLProxyCommon.load(ccMySQLProxyCommon.java:16)
at espen.ccMySQL.server.ccMySQLProxyServer.load(ccMySQLProxyServer.java:9)
at espen.ccMySQL.client.ccMySQLProxyClient.load(ccMySQLProxyClient.java:14)
at espen.ccMySQL.ccMySQL.load(ccMySQL.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:485)
at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:140)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:83)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:657)
... 5 more
Caused by: java.lang.ClassNotFoundException: espen.ccMySQL.connectorBlock.BlockMySQLConnector
at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:185)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 35 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: aiq
at codechicken.nei.asm.NEITransformer.transform(NEITransformer.java:158)
at cpw.mods.fml.relauncher.RelaunchClassLoader.runTransformers(RelaunchClassLoader.java:228)
at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:173)
... 37 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: aiq
at codechicken.core.asm.ClassHeirachyManager.classExtends(ClassHeirachyManager.java:65)
at codechicken.core.asm.ClassHeirachyManager.classExtends(ClassHeirachyManager.java:71)
at codechicken.core.asm.ClassHeirachyManager.classExtends(ClassHeirachyManager.java:29)
at codechicken.nei.asm.NEITransformer.transformer001(NEITransformer.java:34)
at codechicken.nei.asm.NEITransformer.transform(NEITransformer.java:150)
... 39 more
Caused by: java.lang.ClassNotFoundException: aiq
at cpw.mods.fml.relauncher.RelaunchClassLoader.findClass(RelaunchClassLoader.java:89)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at codechicken.core.asm.ClassHeirachyManager.classExtends(ClassHeirachyManager.java:56)
... 43 more
Im getting that error when running tekkit lite MC 1.4.7 and did not extract anything besides the java thing… Help?
I am also new at MySQL. How would this work? Can I use it locally like computerA requesting password information from computerB (This ccMySQL being computerB)
I have no clue on how to setup MySQL and I only want to use it like this: [media]http://www.youtube.com/watch?v=NF9RwBBS60Q&list=FLIcDXMDPtQ_eKS4TTUb-_cQ&index=1[/media]
Can I set it up like the video above but without a REAL MySQL server? If not then how can I set it up with a MySQL server?
Espen #29
Posted 13 January 2013 - 11:46 PM
@unstopablekk:
There is no ccMySQL version for MC 1.4.7 yet, I think you misinterpreted the title. It says CC 1.47 (meaning ComputerCraft 1.47), not MC 1.4.7 ^_^/> (Think I'm going to change that to make it more obvious in the future)
Judging from your crash report it looks like Forge can't find the classes from this mod, which either indicates that you've not put the .zip in the mods folder, or that something changed with MC 1.4.7
I haven't looked into MC 1.4.7 yet, as I am just finishing up work on the next version of this mod, so I can't tell you yet if the new MC version is a problem or not.

As to your question for how to use this mod:
If you play singleplayer, then all connections to databases are made via your computer.
If you play on a server, then all connections to databases are mode via the server.
That means the server owners either have to setup a database server for this mod or have to allow outbound connections made via this mod, or else you can't use it.

Whichever way you do it, you definitely need a real MySQL server though. That was the whole point for doing this mod.^^
It enables you to connect to a real database (via Java database drivers) and issue commands on it via ComputerCraft commands.
And yes, you can do something like in the video with a real database. But it involves a lot more steps.
You need a DBMS (MySQL in this version), create a database, create a table in this database with all the necessary fields, create a Lua program which takes input sent to it via rednet and access the database fields to check if the input matches.

If you haven't done anything like that before, then I'd suggest learning SQL first and how to setup a DBMS, as that is essential if you want to make your own database server.
If you just want to access someone else's database, then simply follow the instructions in the OP.
You need a valid username and password to the database server you're trying to connect to, of course.

I'm almost done with the new update which will change a few things.
At the moment I'm editing the OP (offline). After that I'm going to take a look at the new MC 1.4.7 and compile for it too, if it turns out to be necessary to work.

Will report back as soon as I'm done.
unstopablekk #30
Posted 14 January 2013 - 05:27 AM
@Espen Thanks for your reply, im extremely interested and will definitely look into MySQL setting up databases since this looks very promising.
Espen #31
Posted 14 January 2013 - 10:47 AM
K, I'm finally done with the new version.
Added 2.0 beta downloads &amp; changed the OP.
Espen #32
Posted 15 January 2013 - 11:21 PM
Omg, why did nobody tell me? The Dropbox Link was still pointing to the old version! :wacko:/>

Fixed, it points to v2.0 beta now, sorry for any confusion. ^_^/>
Meni #33
Posted 19 January 2013 - 07:18 PM
Awesome a nice ideao would put the misc peripherals controled crafter recipes on this database.
immibis #34
Posted 20 January 2013 - 02:42 PM
Awesome a nice ideao would put the misc peripherals controled crafter recipes on this database.
This mod doesn't include a database. It lets you connect to a real, outside-Minecraft database.
Meni #35
Posted 22 January 2013 - 05:23 PM
Awesome a nice ideao would put the misc peripherals controled crafter recipes on this database.
This mod doesn't include a database. It lets you connect to a real, outside-Minecraft database.
Yes would be cool if some one host a database with many crafting patterns , thhat what im talking about
iownall555 #36
Posted 23 January 2013 - 06:44 PM
In the new update, trying to connect to a database raises a "attempted to call nil" error for me.
I've tried:

sql = peripheral.wrap("left")
db = sql.connect(url, user, pass)
and

sql = peripheral.wrap("left")
db = sql.getNewConnection(url, user, pass)

Both give me the same error. I've checked if the API is leaded and it has.

Edit: Forgot to mention that I'm running Minecraft 1.4.6
Espen #37
Posted 24 January 2013 - 12:30 AM
@iownall555:
Connecting doesn't work like that anymore.
The new version comes with a Lua-side API called "ccDB".
If you place down the peripheral next to a computer and start/restart the computer, then the file should exist in "rom/apis/"
(But you can also extract it from the lua-folder of the mod, put it in a specific computer and then load it via os.loadAPI() if you prefer it that way)

Using this new API, you connect like so:
db = ccDB.getNewConnection(url, user, pass)
This will create db as a database "object" (really a table).
From then on, everything you do with the db "object" will only affect that particular connection.
Keep in mind though that all database "objects" you create have to execute their functions with a colon, like this:
db:executeQuery("SELECT * FROM table")

You should only ever use the dot for calling functions on the ccDB API:
ccDB.getVersion()
ccDB.getDebug()
-- and so on...



Now if you don't want to use the API, but rather do everything yourself, then that's totally possible, albeit you have to type more.
sql = peripheral.wrap("left")
db = sql.getNewConnectionID(url, user, pass)  -- Returns a unique number to identify this particular connection. Notice the 'ID' at the end.
Since you could open multiple connections, before you execute a function on a database connection now you need to make sure to tell the peripheral on which particular connection you want to execute the command.
Like this:
sql.setCurrentConnectionID(db)  -- Tells the peripheral to set itself to the ID of 'db'
sql.executeQuery("SELECT * FROM table")
You don't have to use setCurrentConnectionID() before every command though, only whenever you want to switch to another connection.
And notice that there is no database "object" on which we call the functions. We have to do all the calls directly with the peripheral ("sql").
That's also the reason why we're not using a colon for the function calls, but a dot.
The colon is only need when using database "objects".

So as you can see, with the API I tried to relieve you from switching around connections manually and instead provide you with the convenience of connection "objects".
But it's totally up to you which method you choose.
If you want to know more specifics, take a look at the General usage section in the OP.

Cheers :)/>
iownall555 #38
Posted 24 January 2013 - 01:12 PM
Thanks so much for the help. I think I may have gotten the API confused with the peripheral.wrap() in my last post because I made the assumption that you had used "ccDB" as an example name for the peripheral. But it is working for me now.
Thanks again. :)/>
Espen #39
Posted 24 January 2013 - 01:29 PM
No problem at all, glad it works for you now.
If you encounter any other problems or think you've found a bug, etc. then please let me know. I always enjoy constructive feedback.
Other than that, have fun. ^_^/>
rm_you #40
Posted 24 January 2013 - 04:02 PM
I love this concept – this is exactly what I need for one of my more ambitious in-game projects.

Unfortunately, I haven't been able to get a connection working yet. No matter what I do, I can't seem to get it to load any JDBC drivers.
I'm on Debian (Squeeze) and I've tried with Postgres and SQLite (though I have no idea if SQLite will work, since I don't think you've tested with it) to no avail. I always get this output:

[SEVERE] [ccDB] No suitable driver found for jdbc:postgres://localhost
[SEVERE] [ccDB] No suitable driver found for jdbc:sqlite:test.db

The ingame commands I've tried are:
db = ccDB.getNewConnection("jdbc:postgres://localhost", "myuser", "mypass")
db = ccDB.getNewConnection("jdbc:sqlite:test.db", "a", "a")
I'm not sure about the user/pass on the second one, since SQLite doesn't have user/pass based security…

I've tried putting the JDBC jarfiles for Postgres and SQLite in the mods/ folder (wherein Forge *says* it has injected them into the classpath).
I've tried setting the classpath / bootclasspath on the commandline when starting the server.
I've tried setting the CLASSPATH environment variable.
I've tried after installing libpg-java via apt-get (the package for the postgres JDBC jar), which should install into the global classpath on the system.

I've also tried with and without using the commandline option: -Djdbc.drivers=org.sqlite.JDBC

Nothing seems to work. Any ideas?

For reference, the SQLite driver is here: https://bitbucket.or...ial/sqlite-jdbc

Edit: HA! I found a combination that I apparently missed but does work, involving -Xbootclasspath and -Djdbc.drivers (which I am now pretty sure is case sensitive); unfortunately, SQLite looks like a no-go because of the following error:
[SEVERE] [ccDB] SQLite only supports TYPE_FORWARD_ONLY cursors

Oh well, guess I'll see if I can get Postgres working and just use that. SQLite would be really nice though if you feel like giving it a shot. :)/>

Edit 2: It looks like for Postgres I was formatting my URL incorrectly. It's supposed to be "jdbc:postgresql://host/db". Missed the "ql" and DB is *required*. Well, I feel dumb now. Would still love SQLite support though!

Edit 3: Connected to a Postgres database, but every query I try to run with db:executeQuery() just returns an error.
For example, I have a table named "bob":

db = ccDB.getNewConnection("jdbc:postgresql://myserver/mydb", "myuser", "mypass")
db:executeQuery("SELECT * FROM bob")
db:executeQuery("SELECT * FROM bob;")
db:executeQuery("SELECT * FROM mydb.bob")
db:executeQuery("SELECT * FROM mydb.bob;")
The db opens correctly, but then all four queries just return:

string:10: java.lang.AbstractMethodError cannot be cast to java.lang.Exception
I work with MSSQL all day at work, but I'm not super familiar with Postgres; maybe I am just doing something obviously wrong?
I tried turning on debugging, but it doesn't print anything to the server console when the queries fail. :(/>
It looks like even db:disconnect() causes that error (except on line 9).

Edit 4: So, looks like Debian ships with the JDBC3 version of the Postgresql lib; manually switched to the JDBC4 version and it seems to be working BETTER. Disconnect works, and the queries at least return some sort of error that looks like it's from the DB instead of Java just breaking.

Edit 5: Alright, got it working, the last issue was just me not knowing PostgreSQL syntax. So, a couple of notes for fixes to your documentation:

You list an example connection string using "jdbc:postgres". That is incorrect – it's "jdbc:postgresql". Also, the database is *required* in the connection string for Postgres, I suppose possibly unlike MySQL.
For the java commandline, you have the -Xbootclasspath completely inside quotes, which doesn't work. It needs to be unquoted.
Here's my java commandline:

java -Xmx1G -Xms1G -Xbootclasspath/a:/home/adam/tekkit-lite/postgresql.jar -Djdbc.drivers=org.postgresql.Driver -jar TekkitLite.jar nogui

So, you can ignore almost everything I said, but I'll leave it here just in case someone else has a similar issue so they don't have to blindly stumble through it like I did. :P/>
Espen #41
Posted 25 January 2013 - 02:48 AM
@rm_you:
Wow, you went through quite the adventure there. Sorry for causing you so much trouble.
But a post like yours was exactly what I was waiting for. One can only test so much alone, so I appreciate the detailed report! :)/>

Putting the -Xbootclasspath in double quotes-works for me in Windows, so that might be an idiosyncrasy of Linux (or Windows, depending on your POV^^). I always put paths into double-quotes whenever it contains spaces, as that makes sure Windows reads the whole thing as one path and not as two separate parameters. On Linux this might be handled differently.
But yeah, in the end it depends on ones specific system and location of the JDBC driver.
I'll try to experiment with escape characters for the path and see if that works as well.
But I think I'll take out the double-quotes in the documentation to make it more system-neutral.

Thanks for spotting the error of me writing jdbc:postgres instead of the proper jdbc:postgresql
Must've overlooked this, as I was indeed testing with Postgres too.

As for always needing to have the database name in the jdbc path for Postgres:
Specifying the database on a JDBC connection is indeed a requirement for Postgres: http://jdbc.postgres...ad/connect.html
[strike]It isn't for MySQL because I guess every installation of it handles tables on only one database? At least that usually seems to be the case.[/strike]
(Nope, it just seems to be a particular requirement for Postgres).
So yeah in the end it depends on the specific DMBS you want to use and depending on which one you want to use you need different drivers, different jdbc-paths, etc.
That's why I'd definitely advise to always consult the respective JDBC documentation.

I should've mentioned that I was developing with JDBC v4, so thanks for that too.^^

Regarding this error:
string:10: java.lang.AbstractMethodError cannot be cast to java.lang.Exception
Would it be possible for you to reproduce this error with debug set to true?
This should print out the whole stack-trace of the error into the "ForgeModLoader-client-0.log" or "ForgeModLoader-server-0.log".
I'd like to take a look at that and try to make the error messages for that more meaningful.
But only if it's not a hassle! :)/>

Finally, about SQLite:
As the error message says, it seems it only support a TYPE_FORWARD_ONLY cursor, meaning that you can only move forward through a ResultSet.
At the moment ccDB has TYPE_SCROLL_INSENSITIVE, as well as CONCUR_UPDATABLE hardcoded, which allows "free reign" so to speak. ^_^/>
I plan on changing that though, so that you'll be able to set any type of mode for the statement that returns a ResultSet.
(For possible types and modes see: http://docs.oracle.c...l#field_summary)
So SQLite can work with ccDB in principle, but not in the current version.
It should be quite trivial to add a function to let a user set type and mode for each DB connection, but I don't know what ramifications that might have further down the line, so I'll have to do some tests first.

Also it's very thoughtful of you to leave your journey intact throughout edits for the benefit of others. [+1]
Too many times have I seen mindless people just remove everything they wrote and simply post "Nevermind, figured it out" <_</>


Ok, I'll make some fixes in the OP now.
Thanks again for the detailed report, I really appreciate it!
Cheers
Edited on 25 January 2013 - 02:07 AM
rm_you #42
Posted 25 January 2013 - 04:57 AM
Putting the -Xbootclasspath in double quotes-works for me in Windows, so that might be an idiosyncrasy of Linux (or Windows, depending on your POV^^). I always put paths into double-quotes whenever it contains spaces, as that makes sure Windows reads the whole thing as one path and not as two separate parameters. On Linux this might be handled differently.
But yeah, in the end it depends on ones specific system and location of the JDBC driver.
I'll try to experiment with escape characters for the path and see if that works as well.
But I think I'll take out the double-quotes in the documentation to make it more system-neutral.
I didn't test it, but I am pretty sure you can leave the actual *path* in quotes; the issue was putting the *whole thing* in quotes. This would probably work:
-Xbootclasspath/a:"/path/to/jdbc.jar"

Regarding this error:
string:10: java.lang.AbstractMethodError cannot be cast to java.lang.Exception
Would it be possible for you to reproduce this error with debug set to true?
This should print out the whole stack-trace of the error into the "ForgeModLoader-client-0.log" or "ForgeModLoader-server-0.log".
I'd like to take a look at that and try to make the error messages for that more meaningful.
I tried with debug mode on, and it wasn't printing *anything*. No idea why. Back when I was having problems with loading the JDBC drivers, it was printing stack traces, but this didn't print anything at all. Still, it doesn't matter too much probably, since we know it was just because the JDBC3 jar for Postgres doesn't work. No issues with the JDBC4 version.

It should be quite trivial to add a function to let a user set type and mode for each DB connection, but I don't know what ramifications that might have further down the line, so I'll have to do some tests first.
Yeah, I wouldn't see there being any issues with adding said function – though it would have to either default to the more basic forward only cursor mode and allow it to be changed manually, or else be specified at or before the connection call.

One option would be specifying the default mode for new connections like this:

ccDB.connectionMode( mode ) //there would obviously be a default mode, and this wouldn't be required 90% of the time
db = ccDB.getNewConnection( url, user, pass )

I am actually really new to Lua, so I don't know if it is possible to do function polymorphism / method overloading, or default values for parameters… If so, this would be nice:

db = ccDB.getNewConnection( url, user, pass [, mode ] )
Edit: Cool, this is totally possible to do – apparently Lua is more fully-featured than I originally thought. Can just check if mode == nil, and set it to the default.

Alternatively, I'd be willing to use a new function if it meant being able to use SQLite instead of, well, not:

db = ccDB.getNewConnectionAdvanced( url, user, pass, mode )

If you always default to the lowest common denominator for the initial connection (something simple like forward only):

db = ccDB.getNewConnection( url, user, pass )
db:setConnectionMode( mode ) //the user can always fix it later, though this might be annoying if people expect advanced scroll modes by default, and could break old code

Maybe the simplest and most foolproof way I just thought of while typing this would be to do a fallback in your code… This should work in pretty much any case and not cause any breakage or incompatibility:

  public DatabaseConnection(String url, String user, String password) throws SQLException
  {
	this.conn = DriverManager.getConnection(url, user, password);
	try {
	   //I don't know if you're using the integer values directly instead of the named constants, or if this is a symptom of my decompiler...
	   this.stmt = this.conn.createStatement(1004, 1008);
	} catch (SQLException e) {
	   this.stmt = this.conn.createStatement(1003, 1008);
	   //this.stmt = this.conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
	}
  }
It should get a fancy scrolling connection if possible, but if it breaks it will try to get a simpler connection, and if THAT breaks it will just throw an exception the same as it did before. You could get fancier and actually look at the exception to see if the scroll mode is the issue, but I'd have to play around to find out exactly what the exception's values would be in that case and I don't have a compiler handy right now. :P/>

Anyway, thanks for the hard work, I will hopefully get to actually USE this tonight, after spending most of yesterday night getting it working on my server. :)/>
Edited on 25 January 2013 - 05:14 AM
Espen #43
Posted 25 January 2013 - 06:34 AM
I didn't test it, but I am pretty sure you can leave the actual *path* in quotes; the issue was putting the *whole thing* in quotes. This would probably work:
-Xbootclasspath/a:"/path/to/jdbc.jar"
Aha, ok I see, misunderstood you then. Well I've just completely removed the quotes from the instructions now and went with escape characters.
Aside from that I just trust that whoever wants to use this peripheral knows how to use proper command line paths, hehe. ^_^/>


I tried with debug mode on, and it wasn't printing *anything*. No idea why. Back when I was having problems with loading the JDBC drivers, it was printing stack traces, but this didn't print anything at all. Still, it doesn't matter too much probably, since we know it was just because the JDBC3 jar for Postgres doesn't work. No issues with the JDBC4 version.
Hmm, ok then, gonna have to look into this with some JDBC 3 driver sometime. I'd like to at least print out some meaningful message.


Yeah, I wouldn't see there being any issues with adding said function – though it would have to either default to the more basic forward only cursor mode and allow it to be changed manually, or else be specified at or before the connection call.
My plan for the change was to orient myself at the generic Java JDBC interface, which defaults to a cursor of TYPE_FORWARD_ONLY with a concurrency of CONCUR_READ_ONLY if one doesn't explicitly set them up during statement creation, as can be seen here: http://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#createStatement()


I am actually really new to LUA, so I don't know if it is possible to do function polymorphism or default values for parameters… If so, this would be nice:

db = ccDB.getNewConnection( url, user, pass [, mode ] )
That is possible in Lua, but since it maps to an exposed Java method I can just overload said method Java-side, which I'll most probably do (in addition to two separate functions, see below).
This way one can set the type and mode (concurrency really) from the get-go, if one so chooses, but also change it later on in one's Lua code if need be.
So in the end it'll be something like:

db = ccDB.getNewConnection( url, user, pass [, type=TYPE_TO_USE ] [, concurrency=CONCURRENCY_TO_USE ] )
db:setType( type )  //optional, to change previously setup type
db:setConcurrency( concurrency )  //optional, to change previously setup concurrency
And I'm not too concerned with breaking old code for this, because these are connection settings which are only setup once for every connection and are thus easily changeable.
Not a good practice in general yeah, but hey, it's beta for a reason. :P/>


I don't know if you're using the integer values directly instead of the named constants, or if this is a symptom of my decompiler…
That must be the compiler, as I'm using the named constants. Which one are you using, the one from http://java.decompiler.free.fr/ ?
When the mod has proven to be stable enough I'm planning on releasing the source-code with all the comments and build-instructions, etc. so that one doesn't have to decompile it anymore, as well as understand what the heck I was doing with certain parts of the code. ^_^/>


Anyway, thanks for the hard work, I will hopefully get to actually USE this tonight, after spending most of yesterday night getting it working on my server.
No problem, I hope you'll be able to tinker with it finally.
Have fun! :)/>

EDIT:
Just FYI, this post was written before your edits.^^
Edited on 25 January 2013 - 05:35 AM
rm_you #44
Posted 25 January 2013 - 08:20 AM
Well, if you feel like compiling a quick hotfix version that does a fallback with try/catch like I mentioned, I'd definitely try it out. You know, if you feel like it. :P/>

As for JDBC3 – honestly, I'd just post a note that says "USE JDBC4 DRIVERS!" and be done with it, for now. Hopefully most currently maintained drivers are updated at this point…

Edit: Yep, http://java.decompiler.free.fr/ is the one. Love the standalone GUI, so wonderfully portable.
Edited on 25 January 2013 - 07:36 AM
Espen #45
Posted 25 January 2013 - 08:55 AM
Well, if you feel like compiling a quick hotfix version that does a fallback with try/catch like I mentioned, I'd definitely try it out. You know, if you feel like it.
Hehe, I catch your drift.^^
I'll see what I can do sometime later today. But no promises, as I'm leaving for a few hours and don't know how soon I'll be back.
But I'll send you a PM and let you know as soon as I have a fix ready. That I can promise. :)/>


EDIT:
It seems it's not as simple as setting the ResultSet type, SQLite works a bit differently.
It doesn't implement isClosed() for its statements for one thing, which makes sense for SQLite I guess, as one doesn't really "hold" a statement object, but just executes them and is done.
Since I don't know yet how many other things SQLite does differently and SQLite is not really the scope of the peripheral anyway (being a file-based database) I don't think I'm going to make its integration a priority right now.
I just currently don't have the time for the R&amp;D this would involve. Really sorry rm_you :unsure:/>

If you want to store information in files, then you can do that using Lua tables.
An explanation can be found e.g. here: [topic='7368'][Lua][Question] Need Help Making A Database[/topic]
It won't let you execute queries or anything though.
There are SQLite wrappers for Lua, but most of them need the "require" function, which ComputerCraft's Lua doesn't provide.
So you either have to find a wrapper that doesn't need "require" or a workaround for "require" that can work from within ComputerCraft.

On another note, I got the AbstractMethod error message too while trying to get SQLite to work and was at least able to fix that.
That means all error messages and stack-traces should now be logged correctly.
Will upload the update later today.

Sorry again for the disappointment, but SQLite has to wait for the moment, I'm afraid. :(/>
Edited on 26 January 2013 - 01:12 AM
rm_you #46
Posted 26 January 2013 - 03:56 AM
Sorry again for the disappointment, but SQLite has to wait for the moment, I'm afraid. :(/>

Ha, no problem. Got it working with Postgres, and while it's not ideal for a multi-user server (I have to set up a bunch of user accounts and databases for people, instead of them just making their own file) it is *working*. Maybe once you decide to open the source, I could take a look and submit some patches. Thanks for taking a look, at least. You did more than I asked you to already! :)/>
Espen #47
Posted 26 January 2013 - 04:42 AM
Ha, no problem. Got it working with Postgres, and while it's not ideal for a multi-user server (I have to set up a bunch of user accounts and databases for people, instead of them just making their own file) it is *working*.

I have to admit giving users their own space on a DBMC to go willy nilly with databases, tables, etc. wasn't really what I had in mind while developing. :lol:/>
I was thinking more along the lines of the classical use of databases, i.e. pre-determined tables made available for data extraction and insertion, like you'd use it for most software or web-services.
What you describe sounds more like giving users their own space without pre-determined data-structures, mainly to store their own data.
In theory that should be possible. It just depends on the ability of the respective DMBS (Postgres in this case) to define roles/groups with the necessary rights.
But yeah, letting them use SQLite in this scenario would definitely be faster and less complicated. ^_^/>

Does it have to be able to understand SQL or do you just want to be able to store and retrieve data in general in a database-like way?
Because I think some people in the forum have already attempted something like this and there might already exist such file-based solutions.
Maybe a search for 'database' or 'storage' and the like might yield some results.
I can only remember that I did a similar search before attempting this peripheral, as I wanted to see if someone already created a similar peripheral.
And back then I think there already were some Lua-side implementations for data storage.
rm_you #48
Posted 30 January 2013 - 01:38 PM
I have to admit giving users their own space on a DBMC to go willy nilly with databases, tables, etc. wasn't really what I had in mind while developing. :lol:/>
I was thinking more along the lines of the classical use of databases, i.e. pre-determined tables made available for data extraction and insertion, like you'd use it for most software or web-services.
What you describe sounds more like giving users their own space without pre-determined data-structures, mainly to store their own data.
In theory that should be possible. It just depends on the ability of the respective DMBS (Postgres in this case) to define roles/groups with the necessary rights.

Well, it's not exactly an enterprise SQL server, it's just for personal projects anyway, so I'm not really worried. My strategy WAS going to be "one user account and one database for that account, per person who wants to use ccSQL". What we ended up doing (myself and the other admin, whose SQL server it technically is) was making one user and giving it to everyone on the server, giving that user access to its own database, and telling people to use their username or an understood-to-be-unique derivative as a prefix for any tables they make. Mine are "rm_exampleTable". It seems to work fine, as you can run CREATE TABLE commands from db:executeQuery().

SQL syntax is a bit of a requirement, as quite a few of us are using SQL daily at work and would like to use our skills for more productive/fun projects. Also, direct file access without a DB parser is hell for doing any kind of complicated logic, because then we'd have to do it in Lua, and I wouldn't describe Lua as "fun" by any stretch. Maybe by the time we do a server reset, you'll have figured it out (or released the source, and I can take a crack at it), but for now, ccDB is working great as-is. Thanks!
Biohazard #49
Posted 04 February 2013 - 12:21 AM
Instead of loading the JDBC jar files through the mc startup arguments, why dont you load it through a classloader using a config file that points to the jar? :)/>
Espen #50
Posted 05 February 2013 - 12:45 AM
Instead of loading the JDBC jar files through the mc startup arguments, why dont you load it through a classloader using a config file that points to the jar? :)/>
No reason really. I just went with the faster way because I wanted to concentrate on the mod's core functionality, which went through a lot of refactoring since my design-choices changed a few times.
But doing it the way you described is definitely something I might do in the next version.
I'm in the middle of writing exams so I haven't had time yet to continue development since last release.
But once I've got some breathing room again, I'll take a crack at the classloading of the jar.
If only for the fact that it would allow me to trim down the installation instructions. ^_^/>
xuma202 #51
Posted 10 February 2013 - 11:33 AM
Hello.

I've found a bug. When you connect the ccDB to a computer via Xfels peripheral cables it'll crash minecraft and break your world.

Here is the log:
SpoilerMinecraft has crashed!
———————-

Minecraft has stopped running because it encountered a problem; Ticking tile entity

A full error report has been saved to C:\Users\cw\AppData\Roaming\.minecraft\crash-reports\crash-2013-02-09_23.35.14-server.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash :(/>



— BEGIN ERROR REPORT 8b2027cb ——–
Full report at:
C:\Users\cw\AppData\Roaming\.minecraft\crash-reports\crash-2013-02-09_23.35.14-server.txt
Please show that file to Mojang, NOT just this screen!

Generated 09.02.13 23:35

– Head –
Stacktrace:
at espen.ccdb.LuaAPILoader.mountLuaAPI(LuaAPILoader.java:82)
at espen.ccdb.TileEntityDBConnector.attachActions(TileEntityDBConnector.java:201)
at espen.ccdb.TileEntityDBConnector.attach(TileEntityDBConnector.java:234)
at xfel.mods.cccable.common.blocks.TileCableServer.doAttachPeripheral(TileCableServer.java:203)
at xfel.mods.cccable.common.blocks.TileCableServer.updateConnections(TileCableServer.java:156)
at xfel.mods.cccable.common.blocks.TileCableServer.g(TileCableServer.java:76)

– Tile entity being ticked –
Details:
Name: PeripheralCable // xfel.mods.cccable.common.blocks.TileCableServer
Block type: ID #0
Block data value: Unknown? (Got -1)
Block location: World: (-266,4,-1189), Chunk: (at 6,0,11 in -17,-75; contains blocks -272,0,-1200 to -257,255,-1185), Region: (-1,-3; contains chunks -32,-96 to -1,-65, blocks -512,0,-1536 to -1,255,-1025)
Stacktrace:
at yc.h(World.java:2155)
at in.h(WorldServer.java:516)

– Affected level –
Details:
Level name: New World
All players: 0 total; []
Chunk stats: ServerChunkCache: 625 Drop: 0
Level seed: -2467386767151028590
Level generator: ID 01 - flat, ver 0. Features enabled: true
Level generator options: 2;7,2x3,1;1;
Level spawn location: World: (-207,4,-1147), Chunk: (at 1,0,5 in -13,-72; contains blocks -208,0,-1152 to -193,255,-1137), Region: (-1,-3; contains chunks -32,-96 to -1,-65, blocks -512,0,-1536 to -1,255,-1025)
Level time: 1907263 game time, 2297553 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 14350 (now: false), thunder time: 110438 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:679)
at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:598)
at bdz.q(IntegratedServer.java:123)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
at fy.run(SourceFile:849)

– System Details –
Details:
Minecraft Version: 1.4.6
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_13, Oracle Corporation
Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 2231167096 bytes (2127 MB) / 3181838336 bytes (3034 MB) up to 3181838336 bytes (3034 MB)
JVM Flags: 3 total; -Xbootclasspath/a:F:\\mysql-connector-java-5.1.22-bin.jar -Xms3072m -Xmx3072m
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.25 FML v4.6.17.515 Minecraft Forge 6.5.0.489 36 mods loaded, 36 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_CodeChickenCore [CodeChicken Core] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_NotEnoughItems [Not Enough Items] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RPTweaks [RedPower Tweaks] (rptweaks.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ComputerCraft [ComputerCraft] (ComputerCraft1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCTurtle [ComputerCraft Turtles] (ComputerCraft1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerCore [RedPower] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerBase [RP Base] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerWiring [RP Wiring] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ASTU [Aperture Science Turtle Upgrades] (ASTU.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Core [BuildCraft] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Builders [BC Builders] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Energy [BC Energy] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Factory [BC Factory] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Transport [BC Transport] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Silicon [BC Silicon] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_CameraStudio [mod_CameraStudio] (CameraStudioV2.6(1.4.6-1.4.7).zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCCable [ComputerCraft Peripheral Cables] (cccable-1.4.1-universal.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ccDB [ccDB - Database peripheral for ComputerCraft] (ccDB_2.0 beta_mc1.4.6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCLights [CCLights] (CCLights1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
NBTEdit [In-game NBTEdit] (Forge_NBTEditv1.4.6.0.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ImmibisCore [Immibis Core] (immibis-core-52.3.7.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ImmibisPeripherals [Immibis's Peripherals] (immibis-peripherals-52.0.8.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
IC2 [IndustrialCraft 2] (industrialcraft-2_1.112.170-lf.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
IronChest [Iron Chest] (ironchest-universal-1.4.6-4.5.1.199 (1).zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
OCS [OpenCCSensors] (OpenCCSensors-0.1.3-r1.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Railcraft [Railcraft] (Railcraft_1.4.6-6.12.2.0.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerMachine [RP Machine] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerCompat [RP Compat] (RedPowerCompat-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerLogic [RP Logic] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerLighting [RP Lighting] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerWorld [RP World] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerControl [RP Control] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_turtleNBTEditor [Turtle NBT Editor] (xuma.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 0 / 8; []
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'forge,fml'

java.lang.NullPointerException
at espen.ccdb.LuaAPILoader.mountLuaAPI(LuaAPILoader.java:82)
at espen.ccdb.TileEntityDBConnector.attachActions(TileEntityDBConnector.java:201)
at espen.ccdb.TileEntityDBConnector.attach(TileEntityDBConnector.java:234)
at xfel.mods.cccable.common.blocks.TileCableServer.doAttachPeripheral(TileCableServer.java:203)
at xfel.mods.cccable.common.blocks.TileCableServer.updateConnections(TileCableServer.java:156)
at xfel.mods.cccable.common.blocks.TileCableServer.g(TileCableServer.java:76)
at yc.h(World.java:2155)
at in.h(WorldServer.java:516)
at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:679)
at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:598)
at bdz.q(IntegratedServer.java:123)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
at fy.run(SourceFile:849)
— END ERROR REPORT 45bbfd03 ———-
eisensheng #52
Posted 11 February 2013 - 02:56 AM
Looks very neat. From the view of someone who already worked with SQL databases the API looks strange though. It would be nice if you could provide a Cursor factory method instead that can be used to query the database. So we could query multiple statements at once and fetch their data in parallel.
Espen #53
Posted 13 February 2013 - 11:47 PM
Hello.

I've found a bug. When you connect the ccDB to a computer via Xfels peripheral cables it'll crash minecraft and break your world.

Here is the log:
SpoilerMinecraft has crashed!
———————-

Minecraft has stopped running because it encountered a problem; Ticking tile entity

A full error report has been saved to C:\Users\cw\AppData\Roaming\.minecraft\crash-reports\crash-2013-02-09_23.35.14-server.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash :(/>



— BEGIN ERROR REPORT 8b2027cb ——–
Full report at:
C:\Users\cw\AppData\Roaming\.minecraft\crash-reports\crash-2013-02-09_23.35.14-server.txt
Please show that file to Mojang, NOT just this screen!

Generated 09.02.13 23:35

– Head –
Stacktrace:
at espen.ccdb.LuaAPILoader.mountLuaAPI(LuaAPILoader.java:82)
at espen.ccdb.TileEntityDBConnector.attachActions(TileEntityDBConnector.java:201)
at espen.ccdb.TileEntityDBConnector.attach(TileEntityDBConnector.java:234)
at xfel.mods.cccable.common.blocks.TileCableServer.doAttachPeripheral(TileCableServer.java:203)
at xfel.mods.cccable.common.blocks.TileCableServer.updateConnections(TileCableServer.java:156)
at xfel.mods.cccable.common.blocks.TileCableServer.g(TileCableServer.java:76)

– Tile entity being ticked –
Details:
Name: PeripheralCable // xfel.mods.cccable.common.blocks.TileCableServer
Block type: ID #0
Block data value: Unknown? (Got -1)
Block location: World: (-266,4,-1189), Chunk: (at 6,0,11 in -17,-75; contains blocks -272,0,-1200 to -257,255,-1185), Region: (-1,-3; contains chunks -32,-96 to -1,-65, blocks -512,0,-1536 to -1,255,-1025)
Stacktrace:
at yc.h(World.java:2155)
at in.h(WorldServer.java:516)

– Affected level –
Details:
Level name: New World
All players: 0 total; []
Chunk stats: ServerChunkCache: 625 Drop: 0
Level seed: -2467386767151028590
Level generator: ID 01 - flat, ver 0. Features enabled: true
Level generator options: 2;7,2x3,1;1;
Level spawn location: World: (-207,4,-1147), Chunk: (at 1,0,5 in -13,-72; contains blocks -208,0,-1152 to -193,255,-1137), Region: (-1,-3; contains chunks -32,-96 to -1,-65, blocks -512,0,-1536 to -1,255,-1025)
Level time: 1907263 game time, 2297553 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 14350 (now: false), thunder time: 110438 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:679)
at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:598)
at bdz.q(IntegratedServer.java:123)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
at fy.run(SourceFile:849)

– System Details –
Details:
Minecraft Version: 1.4.6
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_13, Oracle Corporation
Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 2231167096 bytes (2127 MB) / 3181838336 bytes (3034 MB) up to 3181838336 bytes (3034 MB)
JVM Flags: 3 total; -Xbootclasspath/a:F:\\mysql-connector-java-5.1.22-bin.jar -Xms3072m -Xmx3072m
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.25 FML v4.6.17.515 Minecraft Forge 6.5.0.489 36 mods loaded, 36 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_CodeChickenCore [CodeChicken Core] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_NotEnoughItems [Not Enough Items] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RPTweaks [RedPower Tweaks] (rptweaks.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ComputerCraft [ComputerCraft] (ComputerCraft1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCTurtle [ComputerCraft Turtles] (ComputerCraft1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerCore [RedPower] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerBase [RP Base] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerWiring [RP Wiring] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ASTU [Aperture Science Turtle Upgrades] (ASTU.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Core [BuildCraft] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Builders [BC Builders] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Energy [BC Energy] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Factory [BC Factory] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Transport [BC Transport] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Silicon [BC Silicon] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_CameraStudio [mod_CameraStudio] (CameraStudioV2.6(1.4.6-1.4.7).zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCCable [ComputerCraft Peripheral Cables] (cccable-1.4.1-universal.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ccDB [ccDB - Database peripheral for ComputerCraft] (ccDB_2.0 beta_mc1.4.6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCLights [CCLights] (CCLights1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
NBTEdit [In-game NBTEdit] (Forge_NBTEditv1.4.6.0.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ImmibisCore [Immibis Core] (immibis-core-52.3.7.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ImmibisPeripherals [Immibis's Peripherals] (immibis-peripherals-52.0.8.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
IC2 [IndustrialCraft 2] (industrialcraft-2_1.112.170-lf.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
IronChest [Iron Chest] (ironchest-universal-1.4.6-4.5.1.199 (1).zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
OCS [OpenCCSensors] (OpenCCSensors-0.1.3-r1.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Railcraft [Railcraft] (Railcraft_1.4.6-6.12.2.0.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerMachine [RP Machine] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerCompat [RP Compat] (RedPowerCompat-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerLogic [RP Logic] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerLighting [RP Lighting] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerWorld [RP World] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerControl [RP Control] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_turtleNBTEditor [Turtle NBT Editor] (xuma.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 0 / 8; []
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'forge,fml'

java.lang.NullPointerException
at espen.ccdb.LuaAPILoader.mountLuaAPI(LuaAPILoader.java:82)
at espen.ccdb.TileEntityDBConnector.attachActions(TileEntityDBConnector.java:201)
at espen.ccdb.TileEntityDBConnector.attach(TileEntityDBConnector.java:234)
at xfel.mods.cccable.common.blocks.TileCableServer.doAttachPeripheral(TileCableServer.java:203)
at xfel.mods.cccable.common.blocks.TileCableServer.updateConnections(TileCableServer.java:156)
at xfel.mods.cccable.common.blocks.TileCableServer.g(TileCableServer.java:76)
at yc.h(World.java:2155)
at in.h(WorldServer.java:516)
at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:679)
at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:598)
at bdz.q(IntegratedServer.java:123)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
at fy.run(SourceFile:849)
— END ERROR REPORT 45bbfd03 ———-
Hmm, that's strange. Have to test this and find the bug. Thanks for the report!

Edit:
This doesn't look like a conflict with CCCable, but it seems that ccDB didn't find its Lua-API.
May I ask how you installed the peripheral? Have you put the archive into the mods folder, or have you extracted it?
Also can you check if the archive contains the folder 'lua' ?

Looks very neat. From the view of someone who already worked with SQL databases the API looks strange though. It would be nice if you could provide a Cursor factory method instead that can be used to query the database. So we could query multiple statements at once and fetch their data in parallel.
Some changes to the API were necessary, because of limitations of the peripheral interface and Lua itself.
You can't e.g. hold a Java Date-Object in Lua, so I had to write proxy-methods to allow at least a limited use of methods like these.
Most methods are untouched though and are only changed in what parameters they take as input (in accordance to the capabilities of the peripherals interface).

A factory for creating multiple statements is something on my todo list. I haven't attempted it yet, because there's not an easy way to keep track of the created statements.
As I've mentioned, you can't return pure Java-Objects to Lua (except for String, Map and some primitive types), so trying to return a statement object isn't possible.
I'd have to keep track of them myself by putting them e.g. in a list and make it so that I can access them from the Lua-side via an integer index or similar.
That's exactly what I'm doing with connection objects at the moment, but it's no as trivial as it sounds as there are a lot of pitfalls.

It'll be a long while though before I actually attempt the next features as I'm in the middle of exams right now and there are some tough nuts to crack.
But I appreciate the input and it's definitely on my "would like to tackle that" list. ^_^/>
Edited on 13 February 2013 - 10:53 PM
immibis #54
Posted 14 February 2013 - 12:57 AM
Hello.

I've found a bug. When you connect the ccDB to a computer via Xfels peripheral cables it'll crash minecraft and break your world.

Here is the log:
SpoilerMinecraft has crashed!
———————-

Minecraft has stopped running because it encountered a problem; Ticking tile entity

A full error report has been saved to C:\Users\cw\AppData\Roaming\.minecraft\crash-reports\crash-2013-02-09_23.35.14-server.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash :(/>



— BEGIN ERROR REPORT 8b2027cb ——–
Full report at:
C:\Users\cw\AppData\Roaming\.minecraft\crash-reports\crash-2013-02-09_23.35.14-server.txt
Please show that file to Mojang, NOT just this screen!

Generated 09.02.13 23:35

– Head –
Stacktrace:
at espen.ccdb.LuaAPILoader.mountLuaAPI(LuaAPILoader.java:82)
at espen.ccdb.TileEntityDBConnector.attachActions(TileEntityDBConnector.java:201)
at espen.ccdb.TileEntityDBConnector.attach(TileEntityDBConnector.java:234)
at xfel.mods.cccable.common.blocks.TileCableServer.doAttachPeripheral(TileCableServer.java:203)
at xfel.mods.cccable.common.blocks.TileCableServer.updateConnections(TileCableServer.java:156)
at xfel.mods.cccable.common.blocks.TileCableServer.g(TileCableServer.java:76)

– Tile entity being ticked –
Details:
Name: PeripheralCable // xfel.mods.cccable.common.blocks.TileCableServer
Block type: ID #0
Block data value: Unknown? (Got -1)
Block location: World: (-266,4,-1189), Chunk: (at 6,0,11 in -17,-75; contains blocks -272,0,-1200 to -257,255,-1185), Region: (-1,-3; contains chunks -32,-96 to -1,-65, blocks -512,0,-1536 to -1,255,-1025)
Stacktrace:
at yc.h(World.java:2155)
at in.h(WorldServer.java:516)

– Affected level –
Details:
Level name: New World
All players: 0 total; []
Chunk stats: ServerChunkCache: 625 Drop: 0
Level seed: -2467386767151028590
Level generator: ID 01 - flat, ver 0. Features enabled: true
Level generator options: 2;7,2x3,1;1;
Level spawn location: World: (-207,4,-1147), Chunk: (at 1,0,5 in -13,-72; contains blocks -208,0,-1152 to -193,255,-1137), Region: (-1,-3; contains chunks -32,-96 to -1,-65, blocks -512,0,-1536 to -1,255,-1025)
Level time: 1907263 game time, 2297553 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 14350 (now: false), thunder time: 110438 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:679)
at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:598)
at bdz.q(IntegratedServer.java:123)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
at fy.run(SourceFile:849)

– System Details –
Details:
Minecraft Version: 1.4.6
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_13, Oracle Corporation
Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 2231167096 bytes (2127 MB) / 3181838336 bytes (3034 MB) up to 3181838336 bytes (3034 MB)
JVM Flags: 3 total; -Xbootclasspath/a:F:\\mysql-connector-java-5.1.22-bin.jar -Xms3072m -Xmx3072m
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.25 FML v4.6.17.515 Minecraft Forge 6.5.0.489 36 mods loaded, 36 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_CodeChickenCore [CodeChicken Core] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_NotEnoughItems [Not Enough Items] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RPTweaks [RedPower Tweaks] (rptweaks.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ComputerCraft [ComputerCraft] (ComputerCraft1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCTurtle [ComputerCraft Turtles] (ComputerCraft1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerCore [RedPower] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerBase [RP Base] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerWiring [RP Wiring] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ASTU [Aperture Science Turtle Upgrades] (ASTU.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Core [BuildCraft] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Builders [BC Builders] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Energy [BC Energy] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Factory [BC Factory] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Transport [BC Transport] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Silicon [BC Silicon] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_CameraStudio [mod_CameraStudio] (CameraStudioV2.6(1.4.6-1.4.7).zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCCable [ComputerCraft Peripheral Cables] (cccable-1.4.1-universal.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ccDB [ccDB - Database peripheral for ComputerCraft] (ccDB_2.0 beta_mc1.4.6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCLights [CCLights] (CCLights1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
NBTEdit [In-game NBTEdit] (Forge_NBTEditv1.4.6.0.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ImmibisCore [Immibis Core] (immibis-core-52.3.7.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ImmibisPeripherals [Immibis's Peripherals] (immibis-peripherals-52.0.8.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
IC2 [IndustrialCraft 2] (industrialcraft-2_1.112.170-lf.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
IronChest [Iron Chest] (ironchest-universal-1.4.6-4.5.1.199 (1).zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
OCS [OpenCCSensors] (OpenCCSensors-0.1.3-r1.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Railcraft [Railcraft] (Railcraft_1.4.6-6.12.2.0.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerMachine [RP Machine] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerCompat [RP Compat] (RedPowerCompat-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerLogic [RP Logic] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerLighting [RP Lighting] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerWorld [RP World] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerControl [RP Control] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_turtleNBTEditor [Turtle NBT Editor] (xuma.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 0 / 8; []
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'forge,fml'

java.lang.NullPointerException
at espen.ccdb.LuaAPILoader.mountLuaAPI(LuaAPILoader.java:82)
at espen.ccdb.TileEntityDBConnector.attachActions(TileEntityDBConnector.java:201)
at espen.ccdb.TileEntityDBConnector.attach(TileEntityDBConnector.java:234)
at xfel.mods.cccable.common.blocks.TileCableServer.doAttachPeripheral(TileCableServer.java:203)
at xfel.mods.cccable.common.blocks.TileCableServer.updateConnections(TileCableServer.java:156)
at xfel.mods.cccable.common.blocks.TileCableServer.g(TileCableServer.java:76)
at yc.h(World.java:2155)
at in.h(WorldServer.java:516)
at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:679)
at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:598)
at bdz.q(IntegratedServer.java:123)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
at fy.run(SourceFile:849)
— END ERROR REPORT 45bbfd03 ———-
Hmm, that's strange. Have to test this and find the bug. Thanks for the report!

Edit:
This doesn't look like a conflict with CCCable, but it seems that ccDB didn't find its Lua-API.
May I ask how you installed the peripheral? Have you put the archive into the mods folder, or have you extracted it?
Also can you check if the archive contains the folder 'lua' ?

Looks very neat. From the view of someone who already worked with SQL databases the API looks strange though. It would be nice if you could provide a Cursor factory method instead that can be used to query the database. So we could query multiple statements at once and fetch their data in parallel.
Some changes to the API were necessary, because of limitations of the peripheral interface and Lua itself.
You can't e.g. hold a Java Date-Object in Lua, so I had to write proxy-methods to allow at least a limited use of methods like these.
Most methods are untouched though and are only changed in what parameters they take as input (in accordance to the capabilities of the peripherals interface).

A factory for creating multiple statements is something on my todo list. I haven't attempted it yet, because there's not an easy way to keep track of the created statements.
As I've mentioned, you can't return pure Java-Objects to Lua (except for String, Map and some primitive types), so trying to return a statement object isn't possible.
I'd have to keep track of them myself by putting them e.g. in a list and make it so that I can access them from the Lua-side via an integer index or similar.
That's exactly what I'm doing with connection objects at the moment, but it's no as trivial as it sounds as there are a lot of pitfalls.

It'll be a long while though before I actually attempt the next features as I'm in the middle of exams right now and there are some tough nuts to crack.
But I appreciate the input and it's definitely on my "would like to tackle that" list. ^_^/>

Try returning an ILuaObject. It's like a peripheral, but not a peripheral. (it has getMethodNames and callMethod methods). I haven't tested returning them from peripherals, but they're used internally in CC (eg as a return value from fs.open)
Espen #55
Posted 14 February 2013 - 06:21 AM
Try returning an ILuaObject. It's like a peripheral, but not a peripheral. (it has getMethodNames and callMethod methods). I haven't tested returning them from peripherals, but they're used internally in CC (eg as a return value from fs.open)
Encapsulating a connection in a mock-peripheral? Hmm, that's actually a pretty clever idea.
That's definitely the first thing I'll play around with before adding anything else.
Because if it works the way I need it to, then it would make things a lot easier.^^
Thanks for the hint, much appreciated! :)/>
xuma202 #56
Posted 14 February 2013 - 07:07 AM
Hello.

I've found a bug. When you connect the ccDB to a computer via Xfels peripheral cables it'll crash minecraft and break your world.

Here is the log:
SpoilerMinecraft has crashed!
———————-

Minecraft has stopped running because it encountered a problem; Ticking tile entity

A full error report has been saved to C:\Users\cw\AppData\Roaming\.minecraft\crash-reports\crash-2013-02-09_23.35.14-server.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash :(/>



— BEGIN ERROR REPORT 8b2027cb ——–
Full report at:
C:\Users\cw\AppData\Roaming\.minecraft\crash-reports\crash-2013-02-09_23.35.14-server.txt
Please show that file to Mojang, NOT just this screen!

Generated 09.02.13 23:35

– Head –
Stacktrace:
at espen.ccdb.LuaAPILoader.mountLuaAPI(LuaAPILoader.java:82)
at espen.ccdb.TileEntityDBConnector.attachActions(TileEntityDBConnector.java:201)
at espen.ccdb.TileEntityDBConnector.attach(TileEntityDBConnector.java:234)
at xfel.mods.cccable.common.blocks.TileCableServer.doAttachPeripheral(TileCableServer.java:203)
at xfel.mods.cccable.common.blocks.TileCableServer.updateConnections(TileCableServer.java:156)
at xfel.mods.cccable.common.blocks.TileCableServer.g(TileCableServer.java:76)

– Tile entity being ticked –
Details:
Name: PeripheralCable // xfel.mods.cccable.common.blocks.TileCableServer
Block type: ID #0
Block data value: Unknown? (Got -1)
Block location: World: (-266,4,-1189), Chunk: (at 6,0,11 in -17,-75; contains blocks -272,0,-1200 to -257,255,-1185), Region: (-1,-3; contains chunks -32,-96 to -1,-65, blocks -512,0,-1536 to -1,255,-1025)
Stacktrace:
at yc.h(World.java:2155)
at in.h(WorldServer.java:516)

– Affected level –
Details:
Level name: New World
All players: 0 total; []
Chunk stats: ServerChunkCache: 625 Drop: 0
Level seed: -2467386767151028590
Level generator: ID 01 - flat, ver 0. Features enabled: true
Level generator options: 2;7,2x3,1;1;
Level spawn location: World: (-207,4,-1147), Chunk: (at 1,0,5 in -13,-72; contains blocks -208,0,-1152 to -193,255,-1137), Region: (-1,-3; contains chunks -32,-96 to -1,-65, blocks -512,0,-1536 to -1,255,-1025)
Level time: 1907263 game time, 2297553 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 14350 (now: false), thunder time: 110438 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:679)
at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:598)
at bdz.q(IntegratedServer.java:123)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
at fy.run(SourceFile:849)

– System Details –
Details:
Minecraft Version: 1.4.6
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_13, Oracle Corporation
Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 2231167096 bytes (2127 MB) / 3181838336 bytes (3034 MB) up to 3181838336 bytes (3034 MB)
JVM Flags: 3 total; -Xbootclasspath/a:F:\\mysql-connector-java-5.1.22-bin.jar -Xms3072m -Xmx3072m
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.25 FML v4.6.17.515 Minecraft Forge 6.5.0.489 36 mods loaded, 36 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_CodeChickenCore [CodeChicken Core] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_NotEnoughItems [Not Enough Items] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RPTweaks [RedPower Tweaks] (rptweaks.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ComputerCraft [ComputerCraft] (ComputerCraft1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCTurtle [ComputerCraft Turtles] (ComputerCraft1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerCore [RedPower] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerBase [RP Base] (RedPowerCore-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerWiring [RP Wiring] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ASTU [Aperture Science Turtle Upgrades] (ASTU.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Core [BuildCraft] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Builders [BC Builders] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Energy [BC Energy] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Factory [BC Factory] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Transport [BC Transport] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
BuildCraft|Silicon [BC Silicon] (buildcraft-A-3.3.0.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_CameraStudio [mod_CameraStudio] (CameraStudioV2.6(1.4.6-1.4.7).zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCCable [ComputerCraft Peripheral Cables] (cccable-1.4.1-universal.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ccDB [ccDB - Database peripheral for ComputerCraft] (ccDB_2.0 beta_mc1.4.6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
CCLights [CCLights] (CCLights1.481.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
NBTEdit [In-game NBTEdit] (Forge_NBTEditv1.4.6.0.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ImmibisCore [Immibis Core] (immibis-core-52.3.7.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
ImmibisPeripherals [Immibis's Peripherals] (immibis-peripherals-52.0.8.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
IC2 [IndustrialCraft 2] (industrialcraft-2_1.112.170-lf.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
IronChest [Iron Chest] (ironchest-universal-1.4.6-4.5.1.199 (1).zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
OCS [OpenCCSensors] (OpenCCSensors-0.1.3-r1.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Railcraft [Railcraft] (Railcraft_1.4.6-6.12.2.0.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerMachine [RP Machine] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerCompat [RP Compat] (RedPowerCompat-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerLogic [RP Logic] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerLighting [RP Lighting] (RedPowerDigital-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerWorld [RP World] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
RedPowerControl [RP Control] (RedPowerMechanical-2.0pr6.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
mod_turtleNBTEditor [Turtle NBT Editor] (xuma.zip) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 0 / 8; []
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'forge,fml'

java.lang.NullPointerException
at espen.ccdb.LuaAPILoader.mountLuaAPI(LuaAPILoader.java:82)
at espen.ccdb.TileEntityDBConnector.attachActions(TileEntityDBConnector.java:201)
at espen.ccdb.TileEntityDBConnector.attach(TileEntityDBConnector.java:234)
at xfel.mods.cccable.common.blocks.TileCableServer.doAttachPeripheral(TileCableServer.java:203)
at xfel.mods.cccable.common.blocks.TileCableServer.updateConnections(TileCableServer.java:156)
at xfel.mods.cccable.common.blocks.TileCableServer.g(TileCableServer.java:76)
at yc.h(World.java:2155)
at in.h(WorldServer.java:516)
at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:679)
at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:598)
at bdz.q(IntegratedServer.java:123)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
at fy.run(SourceFile:849)
— END ERROR REPORT 45bbfd03 ———-
Hmm, that's strange. Have to test this and find the bug. Thanks for the report!

Edit:
This doesn't look like a conflict with CCCable, but it seems that ccDB didn't find its Lua-API.
May I ask how you installed the peripheral? Have you put the archive into the mods folder, or have you extracted it?
Also can you check if the archive contains the folder 'lua' ?

I've just created a new MC with only forge, CC, CCCable and ccDB. I got the same error again. I've placed the unzipped file into the mods folder and it created a directory named ccDB with another directory named lua with file called ccDB on its own.
Espen #57
Posted 15 February 2013 - 12:45 AM
I've just created a new MC with only forge, CC, CCCable and ccDB. I got the same error again. I've placed the unzipped file into the mods folder and it created a directory named ccDB with another directory named lua with file called ccDB on its own.
Ok, I've been able to reproduce this, i.e. every time a cable tries to attach to the peripheral it crashes with your reported error.
Will have to do some debugging, in the meantime you should still be able to use the peripheral by attaching it to the computer directly.
Sorry for the inconvenience, if there are any other problems let me know. I appreciate all the feedback I can get to iron out the bugs.^^

Edit #1: Found the error. Should be trivial to fix. If everything works out I'll upload an update later today. :)/>
Edit #2: Ok, fixed the error. New version is out, check the OP.
Edited on 15 February 2013 - 04:25 AM
TheOddByte #58
Posted 23 March 2013 - 03:30 PM
Can you update this to CC 1.5 soon?
Since I can't install it now :(/>
Espen #59
Posted 26 March 2013 - 11:08 PM
Can you update this to CC 1.5 soon?
Since I can't install it now :(/>

I'm sorry but I don't have any time in the foreseeable future to work on it.
My plate is full with 3 group projects this semester and some personal stuff.
That means I have no idea when I can return to work on it.
It'll be at least a few months, but I can't really say. It all depends on how well workflow will be with my projects.

If updating to MC 1.5 is not too difficult though, then maybe I'll take a look at it on one of the next weekends, depending on how much time I get.
No promises though, because I simply don't know myself either. But I'll keep it in mind. :)/>
TheOddByte #60
Posted 27 March 2013 - 06:14 AM
Umm.. I said CC not MC..
And I don't know if it's hard to update.. But I just know that this peripheral seems nice and I want it since I have almost installed every peripheral now in my new personal modpack! :D/> (60mods)
What group projects are you working on btw?
Espen #61
Posted 27 March 2013 - 09:47 AM
Umm.. I said CC not MC..

Ah sorry, misread that. Well, the same goes for updating it for MC 1.4.7 then.^^
Although I'd wager that the changes from MC 1.4.6 to 1.4.7 aren't as heavy (for mods) as the changes from MC 1.4.7 to 1.5, so updating the mod to MC 1.4.7 (i.e. CC 1.5) might not be too much of a problem. I'll see what I can do this weekend.

What group projects are you working on btw?
One project involves software development with Java and PostgreSQL plus presentations and weekly reports over two semesters.
Another one involves the planning and development of a web-site or -service using analysis, conception, etc. plus presentations and weekly reports over one semester.
All within a group of 4 (I hate group-work) and on top of various practical courses.
If I'm lucky I don't need to do the third project though, but that's still to be determined.
Cloudy #62
Posted 28 March 2013 - 01:41 AM
You shouldn't have to do anything to update to CC 1.5/MC 1.4.7 - obfuscation was compatible!
Espen #63
Posted 28 March 2013 - 03:52 AM
That's good to know, thanks for the heads-up. :)/>
I'll probably be able to upload an update later today then.

EDIT: Ok, since CC's version numbering system works differently than what "mcmod.info" expects, I had to remove the version filter. Apart from that, there weren't any other changes necessary, because apparently I had already released a MC 1.4.7 compatible version and just forgot about it. But now it'll also work with CC 1.5 without giving you the version warning.
Updated OP with v2.0.2, have fun! :)/>
Edited on 28 March 2013 - 05:15 AM
Meni #64
Posted 12 April 2013 - 10:00 AM
I had this error on CC 1.5 And MC 1.4.7

java.lang.ArrayIndexOutOfBoundsException: 5093
at amq.<init>(Block.java:324)
at amq.<init>(Block.java:359)
at akb.<init>(BlockContainer.java:17)
at espen.ccdb.render.BlockDBConnector.<init>(BlockDBConnector.java:18)
at espen.ccdb.common.CommonProxy.registerBlocks(CommonProxy.java:53)
at espen.ccdb.common.CommonProxy.load(CommonProxy.java:46)
at espen.ccdb.client.ClientProxy.load(ClientProxy.java:45)
at espen.ccdb.ccDB.load(ccDB.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:487)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:153)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:86)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:676)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:207)
at net.minecraft.client.Minecraft.a(Minecraft.java:458)
at asq.a(SourceFile:56)
at net.minecraft.client.Minecraft.run(Minecraft.java:746)
at java.lang.Thread.run(Unknown Source)
Espen #65
Posted 12 April 2013 - 10:41 AM
@Meni:
It's too late here for me to look into it right now, but could you also post the "ForgeModLoader-client-*.log" where the error occured?
I'll take a look at it tomorrow then, as soon as I'm back home.

Edit:
I suspect it has something to do with the block ID not being assigned correctly, as it seems to go above 4096 in your error log.
So for the moment try to set a different (lower) ID in the ccDB config file. But make a backup of your map beforehand, as this removes existing ccDB blocks from your map.
But please send me the log anyway, it's always nice to have more information when debugging.
Thx in adavnce :)/>
Edited on 12 April 2013 - 08:47 AM
Meni #66
Posted 13 April 2013 - 01:57 PM
I suspect it has something to do with the block ID not being assigned correctly, as it seems to go above 4096 in your error log.
So for the moment try to set a different (lower) ID in the ccDB config file. But make a backup of your map beforehand, as this removes existing ccDB blocks from your map.
But please send me the log anyway, it's always nice to have more information when debugging.
Thx in adavnce :)/>

Tank u very much for the feedback!
I used the id 5093, the default config was using the id 4093 which is used for the default ccTurtle config, but now i used the 3093 id and it worked! Thank you @Espen !
Edited on 13 April 2013 - 12:03 PM
superaxander #67
Posted 18 April 2013 - 04:40 AM
This is cool!
TheOddByte #68
Posted 18 April 2013 - 12:43 PM
This is cool!
No arguments there since
I really like this peripheral! :D/>
Meni #69
Posted 23 June 2013 - 04:33 AM
Waiting for CC1.53………..
(just saying…)
Espen #70
Posted 25 June 2013 - 07:40 PM
Waiting for CC1.53………..
(just saying…)
Yeah, I feel you, I feel you…
It's just that I don't really have the time to update it at the moment.

If it were a simple case of just recompiling I would've done it ages ago.
But since Forge has changed significantly in how it does certain things, I'd have to do some research before I'd be able to update.
And seeing that I'm fully engaged in a software development project that eats up most of my time, the update won't happen anytime soon I'm afraid. :(/>
Maybe once 1.6 is out and I have some breathing room on some weekends I'll give it a whirl.

And after that I think I'm finally releasing the source with all its comments and Eclipse project files (incl. build-script) so that someone else with some more time on his/her hands might improve on it. :)/>

Sorry for the inconvenience, I hope you understand.
Meni #71
Posted 26 June 2013 - 02:29 PM
Waiting for CC1.53………..
(just saying…)
Yeah, I feel you, I feel you…
It's just that I don't really have the time to update it at the moment.

If it were a simple case of just recompiling I would've done it ages ago.
But since Forge has changed significantly in how it does certain things, I'd have to do some research before I'd be able to update.
And seeing that I'm fully engaged in a software development project that eats up most of my time, the update won't happen anytime soon I'm afraid. :(/>
Maybe once 1.6 is out and I have some breathing room on some weekends I'll give it a whirl.

And after that I think I'm finally releasing the source with all its comments and Eclipse project files (incl. build-script) so that someone else with some more time on his/her hands might improve on it. :)/>

Sorry for the inconvenience, I hope you understand.
Sure i understand, is just because i see many aplications of your mod and i feel bad without a new release for it. Thanks for your creative work
airtonix #72
Posted 05 July 2013 - 10:39 PM
oh sweet! I just discovered this.

I love that you've made a server rack block too!

As a Django developer I would love to have an ORM as well.
Espen #73
Posted 07 July 2013 - 05:28 AM
@airtonix:
Hey, you're the first person that explicitly mentioned that he/she recognized it as a server rack! Wasn't sure if it was indeed recognizable as such, so thx for mentioning it. ^_^/>
The mod isn't updated yet though and won't be for at least a few more weeks (exams &amp; project-deadlines).
But now that MC 1.6 has been released I plan on updating it as soon as I have enough breathing room.

ORM would definitely be possible but seems like a significant project of its own.
That's judging it from the outside though, as I've never actually used it and I haven't researched anything implementation-related yet.
zacekjakub #74
Posted 06 September 2013 - 10:23 AM
@airtonix:
Hey, you're the first person that explicitly mentioned that he/she recognized it as a server rack! Wasn't sure if it was indeed recognizable as such, so thx for mentioning it. ^_^/>
The mod isn't updated yet though and won't be for at least a few more weeks (exams &amp; project-deadlines).
But now that MC 1.6 has been released I plan on updating it as soon as I have enough breathing room.

ORM would definitely be possible but seems like a significant project of its own.
That's judging it from the outside though, as I've never actually used it and I haven't researched anything implementation-related yet.

Hi, just would like to ask you about the current status of ccDB for new minecraft 1.6? Waiting for the release with my friends. :)/> Thank you.
Espen #75
Posted 08 September 2013 - 02:53 PM
Hi, just would like to ask you about the current status of ccDB for new minecraft 1.6? Waiting for the release with my friends. :) Thank you.

Hey, sorry for the late response, wasn't home for a few days.

Skip the following if you're feelin' TL;DR
SpoilerThe current status is that I'm not really working on the mod at the moment. The planning/designing phase of the study project I've talked about earlier has gone over to the actual implementation phase, i.e. now's the time where I start setting up all the tools I need and actually start programming.

During the planning &amp; researching I've come about a way to connect ComputerCraft with databases in a potentially MUCH better way.
When I started the mod I was basically reinventing the wheel and hacked a lot together (e.g. Proxy via Invocation Handler + Reflection, etc.) to make it work.
If I start development on the mod again, then I'd like to rewrite it from scratch to see if what I've learned could actually work out better or not.
Then again, since there actually seem to be some people who are awaiting an update it might be better to simply upgrade the current version first, as that should be a lot faster.

So at the moment my plan is:
  1. Upgrade the current version to MC 1.6
  2. Start a new version from scratch using a different (hopefully more efficient and "readable") method.
  3. Immediately after Step 2: Release Source (finally) because the new version is probably gonna be a lot less messy and I won't need to clean it up :P
The only problem (as always) is time. Unfortunately I still don't have a lot of that next to my group project and our first prototype is due beginning of October.
After that the project will still carry on a few months (rewrites in accordance to the wishes of the "client", optimizations, bugfixes, etc.), along with the courses of the new semester. :-\

Having said all this… (TL;DR starts here)
I don't want to make promises I can't keep, so the most honest guesstimate I can give you of when I'm going to dive back into MC-Modding in order to upgrade ccDB is: Not this month. The next possible time that may work is after October 1st. But that's just because I have no idea if there's anything important I have to do at that time. I'll only know once the date approaches.

EDIT:
Once I'll start programming on the mod again, I'll update the thread with an update-message saying as much.
Edited on 08 September 2013 - 01:00 PM
sci4me #76
Posted 24 September 2013 - 11:04 PM
omg this is so epic! only issue: 1.6.2 :(/> HOPE it updates soon-ish… can't wait to put it on the server… hehehe this shall be funnn
Blade88 #77
Posted 05 October 2013 - 12:52 PM
i hope its will be updatet too :_(
beringtom #78
Posted 12 October 2013 - 04:04 PM
Bookmarked, i see alot of usage for this mod, hope to see you in oct ;)/>
vico #79
Posted 11 January 2014 - 09:17 PM
About 1.6 update… I have 2 questions in mind… don't know if you could answer it now…

Will be possible to load the JDBC driver from the "libraries" folder of minecraft?
This would download the drivers and put in the correct folders?
zacekjakub #80
Posted 04 May 2014 - 06:16 AM
Hello, I would just like to ask you a question about the current ccDB, I am not able to insert new line into the database, just update the string which is already stored, could you please show me a very short code how to do that? Thank you very much!
viluon #81
Posted 04 May 2014 - 01:51 PM
great work you've done! But.. is this being updated?
Espen #82
Posted 04 May 2014 - 05:11 PM
Hello, I would just like to ask you a question about the current ccDB, I am not able to insert new line into the database, just update the string which is already stored, could you please show me a very short code how to do that? Thank you very much!

It was mostly intended for accessing data, but you should be able to use a native SQL INSERT to add a new row by making use of executeQuery(), like so:
executeQuery("INSERT INTO players (firstname, lastname, nickname) VALUES ('Markus', 'Persson', 'Notch');")

So as long as you know SQL, you sould be able to execute any query.
If something goes wrong with that, then first make sure that the SQL query works outside of Minecraft.
If it does but only doesn't work with ccDB, then let me know and if possible provide some of the error messages so I can analyze what's going on.

Having said this though, I am not actively developing this at the moment and I'm not sure when I will have the time to pick it up again. RL has taken most of my time and I can't afford any time to modding. Especially since there have been so many changes with regards to Forge since my last release. And even if I were to pick it up today, I think I would rewrite everything from the ground up.
I'm sorry to disappoint anyone who is waiting for an update, but there won't be coming one for quite some time.
At least not from me.
Alternatives for more current versions of MC and/or CC would be to either use one of the ingame databases that some have written, or to access real databases by way of some proxy, like a PHP-driven webserver that handles the I/O.
I have seen both methods in the past somewhere here in the forums.
mister-man #83
Posted 18 May 2014 - 09:54 PM
Really cool Mod. Great work!

But for a Public server it is not easy for players to connect a own database to use it. A nice feature would be an SQLite support. So every player can store data easily without need of an own server.
Espen #84
Posted 22 May 2014 - 09:34 PM
The idea was that the users are provided with a user account to the server's database, which admittedly is only feasible for whitelisted servers.
But in response to your post, I refer you to one of my earlier posts: [post='80106']Look for "Finally, about SQLite" near the end ot the post.[/post]
NYLoRD #85
Posted 08 June 2014 - 12:03 AM
Is this Mod in work ?
Espen #86
Posted 22 June 2014 - 11:32 PM
Is this Mod in work ?

No, not at the moment.
For details I refer you to this [post='176707']this earlier post[/post] of mine.
zacekjakub #87
Posted 17 July 2014 - 03:07 AM
Hello, thank you for your last reply, helped me so much. :)/> I have just a little other problem now, I use the DB on server very often with various computers and it is spamming my log all the time with informations about created connection and destroying it again, is possible to disable this logging into the console please? :)/> There are no options in my config file of ccDB about this.
Espen #88
Posted 22 July 2014 - 02:08 PM
@[member='zacekjakub']
Upfront: Hmm, I'm afraid those log messages cannot be turned off at the moment. :\

When I started this I implemented a way to enable extra log messages via ccDB.setDebug(true) which would show java stack traces in addition to the normal log messages.
I think the ability to set the log level via config-file was on my todo list, but just not yet imlemented because there were other things I wanted to to first.
Part of the reason why it was low on my list was because I considered the mod experimental still.
But since I don't like my server-logs to be spammed unnecessarily either, I guess it was a bit of an imprudent decision on my part. -_-/>
Damn you Cpt. Hindsight! *raised-fist*

Unfortunately I don't have my Development Environment set up at the moment or else it'd be a simple matter of making a quick patch.
So I'm afraid you're going to have to live with those messages for the time being. Very sorry about that. :unsure:/>
Edited on 22 July 2014 - 12:10 PM
zacekjakub #89
Posted 23 July 2014 - 09:30 PM
Thank you very much anyway, your mod is awesome… I will hope you will find some time in future to patch this, now I will just create a bash script to remove the messages for better readability.