May 21, 2012, 10:41:28 AM

Poll

SQLite

Support the inflexible driver
0 (0%)
Drop it like it's hot!
4 (100%)

Total Members Voted: 3

Voting closed: July 03, 2007, 04:47:06 PM

Author Topic: Database  (Read 620 times)

Scott

  • ForumNazi
  • BNU Leader
  • THE TURKISH EMPEROR
  • *****
  • Posts: 1161
  • Karma: +6/-6
  • BNU-Camel since December 2002
    • View Profile
    • Clan BNU
Database
« on: June 13, 2007, 04:47:06 PM »
Okay, so I spent some time yesterday implementing JDBC - it's an abstract database interface that supports just about every DMBS that exists. It works quite well with MySQL, and I was able to get it to work with some hacks with SQLite.

Here's an example of how to configure Settings.ini for MySQL:
Code: [Select]
[BNUBot]
numBots=1
db_driver=com.mysql.jdbc.Driver
db_url=jdbc:mysql://[host]:3306/[database]
db_username=[username]
db_password=[password]
[1]
packetLog=false
enableGUI=true
...


The default settings are:
Code: [Select]
db_driver=org.sqlite.JDBC
db_url=jdbc:sqlite:database.db
db_username=
db_password=



I'm considering dropping support for SQLite because it doesn't support many things that are just too useful to pass up. If I do, then the bot will still be usable without a database, but it will require disabling the CommandEventHandler plugin - that's the one that does all of the bot commands.

Summary:

Keeping SQLite support:
Pros: Simple setup - no user configuration required
Cons: Cripples DB functionality; DB gets corrupted easily; must maintain two parallel schemas

Dropping SQLite support:
Pros: Enables complex table relationships, inline row updating, triggers, views
Cons: Requires the user to configure a database to use CommandEventHandler

If you'd like to weigh in, here's your chance.
It's like saying, "Hello, my name is Camel and I don't know what I'm talking about."

Bnu-Sorceress

  • BNU Leader
  • THE CONGAN EMPEROR
  • ***
  • Posts: 781
  • Karma: +2/-4
  • Personal text!
    • View Profile
    • http://www.clanbnu.net
Database
« Reply #1 on: June 13, 2007, 09:35:05 PM »
i'd like to be the first to say...







i dont get it.


General: Clan BNU - Member Since September 2002.

John

  • BNU Leader
  • THE TURKISH EMPEROR
  • *****
  • Posts: 1105
  • Karma: +23/-12
  • BNU Founder
    • View Profile
    • http://www.bnet.cc/
Database
« Reply #2 on: June 13, 2007, 09:51:22 PM »
I think, I'd rather use text than MiniSql or whatever.. damn I forgot what the question was. Drop it like its hot man..

Since February 22, 2002

Bnu-Sorceress

  • BNU Leader
  • THE CONGAN EMPEROR
  • ***
  • Posts: 781
  • Karma: +2/-4
  • Personal text!
    • View Profile
    • http://www.clanbnu.net
Database
« Reply #3 on: June 13, 2007, 09:56:32 PM »
i said drop it. i guess just by looking at the pros and cons, and not the other gibberish, i kinda understood it. so ya, drop it.


General: Clan BNU - Member Since September 2002.

Scott

  • ForumNazi
  • BNU Leader
  • THE TURKISH EMPEROR
  • *****
  • Posts: 1161
  • Karma: +6/-6
  • BNU-Camel since December 2002
    • View Profile
    • Clan BNU
Database
« Reply #4 on: June 14, 2007, 06:08:17 AM »
SQLite support is gone. You can probably still get it to connect if you convert the schema and set up the driver, but know before you waste your time that the driver doesn't support the inline updating I now use throughout the code. If you don't want to take my word for it (or if you write a driver that doesn't suck), here's the info you need:

Add sqlitejdbc.jar to the 'lib' folder.

Convert the schema to SQLite-compatible syntax, and put it in a file sqlite.sql.

Edit settings.ini:
Code: [Select]
[database]
schema=sqlite.sql
driver=org.sqlite.JDBC
url=jdbc:sqlite:database.db
[1]
enableCommands=true
It's like saying, "Hello, my name is Camel and I don't know what I'm talking about."