|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
Sqlite 3 adapterIs there a reason why there isn't a sqlite activerecord-jdbc gem? I would have thought since sqlite is the default Rails DB now that there would be one. Just curious if this is something that's being worked on. Thanks.
Joe
|
|
|
Re: Sqlite 3 adapterOn Sat, Apr 19, 2008 at 11:34 PM, Joseph Athman <jjathman@...> wrote:
> Is there a reason why there isn't a sqlite activerecord-jdbc gem? I would > have thought since sqlite is the default Rails DB now that there would be > one. Just curious if this is something that's being worked on. Thanks. Yeah, it seems like it, but sqlite is just not nearly as commonly used in the Java world. There are JDBC adapters out there, but I haven't tried them and don't know how well they work. We'd love to have support for it, as it would make the JRuby story more complete and help address questions like yours. I haven't heard of anyone working on it, so it seems like fair game for someone that has an itch to scratch. Cheers, /Nick --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Sqlite 3 adapterI'd highly recommend using H2 in place of sqlite3, it's already
supported by activerecord-jdbc, so it should be a drop-in replacement. It's probably about the closest java equivalent you'll find. It supports in-memory databases, which great for running your tests. I know there has been some work done on using JNI to interface with the sqlite C library, but I'm not sure how complete that is. -- Larry On Apr 20, 2008, at 1:17 AM, Nick Sieger wrote: > On Sat, Apr 19, 2008 at 11:34 PM, Joseph Athman <jjathman@...> > wrote: >> Is there a reason why there isn't a sqlite activerecord-jdbc gem? >> I would >> have thought since sqlite is the default Rails DB now that there >> would be >> one. Just curious if this is something that's being worked on. >> Thanks. > > Yeah, it seems like it, but sqlite is just not nearly as commonly used > in the Java world. There are JDBC adapters out there, but I haven't > tried them and don't know how well they work. We'd love to have > support for it, as it would make the JRuby story more complete and > help address questions like yours. I haven't heard of anyone working > on it, so it seems like fair game for someone that has an itch to > scratch. > > Cheers, > /Nick > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Sqlite 3 adapterI'm sure other DB's like H2 will work fine for everyone, but I'm sure there are a lot of people who are new to the JRuby community that will create a fresh rails app, try to run it, and have it not work because there isn't sqlite adapter. I think supporting all the defaults of Rails should be something the community aims for. I've looked at the activerecord-jdbc site, but I haven't found anything like "if you want to add support for a new DB, here's where to start".
Is there any documentation out there explaining the architecture behind ar-jdbc? Joe
On Sun, Apr 20, 2008 at 9:01 AM, Larry Myers <larry@...> wrote: I'd highly recommend using H2 in place of sqlite3, it's already supported by activerecord-jdbc, so it should be a drop-in replacement. It's probably about the closest java equivalent you'll find. It supports in-memory databases, which great for running your tests. |
|
|
Re: Sqlite 3 adapterI started playing around with this some. I found what seems like a reasonable JDBC Driver at http://www.zentus.com/sqlitejdbc/
I do have some basic questions though. Why does the H2 adapter not have a jdbc_adapter file like jdbc_h2.rb? It seems like it uses the jdbc_hsqldb.rb file. Are the H2 and HSBLDB adapters bad examples to look at? I'm just trying to figure out what I need to do to get it working. It seems like I have migrations at least partially working and I can perform selects, but it looks like creates are failing.
Anyways, thanks for any help. Joe
On Sun, Apr 20, 2008 at 11:05 AM, Joseph Athman <jjathman@...> wrote: I'm sure other DB's like H2 will work fine for everyone, but I'm sure there are a lot of people who are new to the JRuby community that will create a fresh rails app, try to run it, and have it not work because there isn't sqlite adapter. I think supporting all the defaults of Rails should be something the community aims for. I've looked at the activerecord-jdbc site, but I haven't found anything like "if you want to add support for a new DB, here's where to start". |
|
|
Re: Sqlite 3 adapterOn Mon, Apr 21, 2008 at 9:51 PM, Joseph Athman <jjathman@...> wrote:
> I started playing around with this some. I found what seems like a > reasonable JDBC Driver at http://www.zentus.com/sqlitejdbc/ > > I do have some basic questions though. Why does the H2 adapter not have a > jdbc_adapter file like jdbc_h2.rb? It seems like it uses the jdbc_hsqldb.rb > file. Are the H2 and HSBLDB adapters bad examples to look at? I'm just > trying to figure out what I need to do to get it working. It seems like I > have migrations at least partially working and I can perform selects, but it > looks like creates are failing. > Cool. Yeah, sorry there isn't a HOWTO for porting a new adapter yet. The basic approach is to do a few things: - new lib/jdbc_adapter/jdbc_sqlite.rb -- follow constant naming conventions inside according to others. 'jdbc_adapter/jdbc_sqlite' needs to be required in lib/active_record/connection_adapters/jdbc_adapter_spec.rb (probably should be in a better place) - new test/sqlite_simple_test.rb + test/db/sqlite.rb -- follow other existing ones as well - new rake task in the rake file to run the tests, if you desire. /Nick --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Sqlite 3 adapter
H2 and HSQL have very similar SQL dialects (I think they were both
started by the same dev). I think they used to share a hibernate
dialect, too.
Joseph Athman wrote: I started playing around with this some. I found what seems like a reasonable JDBC Driver at http://www.zentus.com/sqlitejdbc/ |
|
|
Re: Sqlite 3 adapterThis stuff was very helpful. I spent some time hacking something together, and it's passing most of the tests. From the SQLite documentation renaming columns is not supported and I didn't want to spend the time trying to figure out a way around it.
I'd appreciate it if someone could download what I put together and try it out. I hope that this is enough of a start to get things going on this adapter. It seems to work pretty well for a toy Rails app, but I haven't done extensive testing. I'm pretty sure there will be problems with decimal and date columns. SQLite doesn't have a native Date/Time fields and I wasn't sure exactly how that should get handled.
Just as an FYI, the JDBC driver I downloaded (and included in the zip file) is from http://www.zentus.com/sqlitejdbc/.
Thanks for all the help, Joe
On Mon, Apr 21, 2008 at 11:09 PM, Ryan Bell <ryan.l.bell@...> wrote:
|
|
|
Re: Sqlite 3 adapterCool stuff! Glad you were able to get something working. Keep us
updated on your progress. Since the zentus site seems to be releasing the sqlite driver under BSD, we could include sqlite support out of the box as activerecord-jdbcsqlite3-adapter, as you've done. Could you create an incremental zip of all the new files and attach to JIRA? It will make it easier for us to check it in later. Cheers, /Nick On Wed, Apr 23, 2008 at 12:32 AM, Joseph Athman <jjathman@...> wrote: > This stuff was very helpful. I spent some time hacking something together, > and it's passing most of the tests. From the SQLite documentation renaming > columns is not supported and I didn't want to spend the time trying to > figure out a way around it. > > I'd appreciate it if someone could download what I put together and try it > out. I hope that this is enough of a start to get things going on this > adapter. It seems to work pretty well for a toy Rails app, but I haven't > done extensive testing. I'm pretty sure there will be problems with decimal > and date columns. SQLite doesn't have a native Date/Time fields and I > wasn't sure exactly how that should get handled. > > http://jjathman.railsplayground.net/files/ar-sqlite.zip > > Just as an FYI, the JDBC driver I downloaded (and included in the zip file) > is from http://www.zentus.com/sqlitejdbc/. > > Thanks for all the help, > Joe > > > > On Mon, Apr 21, 2008 at 11:09 PM, Ryan Bell <ryan.l.bell@...> wrote: > > > > H2 and HSQL have very similar SQL dialects (I think they were both started > by the same dev). I think they used to share a hibernate dialect, too. > > > > > > > > > > Joseph Athman wrote: > > I started playing around with this some. I found what seems like a > reasonable JDBC Driver at http://www.zentus.com/sqlitejdbc/ > > > > > > I do have some basic questions though. Why does the H2 adapter not have a > jdbc_adapter file like jdbc_h2.rb? It seems like it uses the jdbc_hsqldb.rb > file. Are the H2 and HSBLDB adapters bad examples to look at? I'm just > trying to figure out what I need to do to get it working. It seems like I > have migrations at least partially working and I can perform selects, but it > looks like creates are failing. > > > > > > Anyways, thanks for any help. > > > > > > Joe > > > > > > On Sun, Apr 20, 2008 at 11:05 AM, Joseph Athman <jjathman@...> > wrote: > > > > > I'm sure other DB's like H2 will work fine for everyone, but I'm sure > there are a lot of people who are new to the JRuby community that will > create a fresh rails app, try to run it, and have it not work because there > isn't sqlite adapter. I think supporting all the defaults of Rails should > be something the community aims for. I've looked at the activerecord-jdbc > site, but I haven't found anything like "if you want to add support for a > new DB, here's where to start". > > > > > > > > > Is there any documentation out there explaining the architecture behind > ar-jdbc? > > > > > > > > > Joe > > > > > > > > > > > > > > > On Sun, Apr 20, 2008 at 9:01 AM, Larry Myers <larry@...> > wrote: > > > > > > > I'd highly recommend using H2 in place of sqlite3, it's already > supported by activerecord-jdbc, so it should be a drop-in replacement. It's > probably about the closest java equivalent you'll find. It supports > in-memory databases, which great for running your tests. > > > > > > > > I know there has been some work done on using JNI to interface with > the sqlite C library, but I'm not sure how complete that is. > > > > > > > > -- Larry > > > > > > > > > > > > > > > > On Apr 20, 2008, at 1:17 AM, Nick Sieger wrote: > > > > > > > > > > > > > On Sat, Apr 19, 2008 at 11:34 PM, Joseph Athman <jjathman@...> > wrote: > > > > > > > > > > > Is there a reason why there isn't a sqlite activerecord-jdbc gem? > I would > > > > > > have thought since sqlite is the default Rails DB now that there > would be > > > > > > one. Just curious if this is something that's being worked on. > Thanks. > > > > > > > > > > > > > > > > Yeah, it seems like it, but sqlite is just not nearly as commonly > used > > > > > in the Java world. There are JDBC adapters out there, but I haven't > > > > > tried them and don't know how well they work. We'd love to have > > > > > support for it, as it would make the JRuby story more complete and > > > > > help address questions like yours. I haven't heard of anyone working > > > > > on it, so it seems like fair game for someone that has an itch to > > > > > scratch. > > > > > > > > > > Cheers, > > > > > /Nick > > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe from this list, please visit: > > > > > > > > > > http://xircles.codehaus.org/manage_email > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe from this list, please visit: > > > > > > > > http://xircles.codehaus.org/manage_email > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Sqlite 3 adapterYep, I can do that. Could you get the JDBC driver in to the trunk? That way I won't have to worry about that will all the diffs, I think it will make things easier for everyone. You don't need to include the other files yet as it's not near ready for widespread use.
Joe On Wed, Apr 23, 2008 at 9:05 AM, Nick Sieger <nicksieger@...> wrote: Cool stuff! Glad you were able to get something working. Keep us |
|
|
Re: Sqlite 3 adapterOn Apr 23, 2008, at 9:54 AM, Joseph Athman wrote:
> Could you get the JDBC driver in to the trunk? By that, do you mean the drivers/sqlite directory? /Nick --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Sqlite 3 adapterSorry, yes. Everything under drivers/sqlite. Then I won't have to deal with the binary file at all. I'll create the JIRA ticket shortly.
Joe On Wed, Apr 23, 2008 at 10:05 AM, Nick Sieger <nicksieger@...> wrote:
|
|
|
Re: Sqlite 3 adapterDone. I created it as drivers/sqlite3 to match the convention used by Rails.
/Nick On Apr 23, 2008, at 10:48 AM, Joseph Athman wrote: Sorry, yes. Everything under drivers/sqlite. Then I won't have to deal with the binary file at all. I'll create the JIRA ticket shortly. |
|
|
Re: Sqlite 3 adapterGreat. I'll try to clean things up some more tonight and give you a real diff to apply.
My main questions about the adapters are in the JdbcSpec::SQLite::Column module. It seems like this is the heart of where the heavy lifting happens. I'm just not sure how I know which methods to overwrite (I'm assuming that's what's happening). It looks like each adapter is different (which makes sense). For example, the modify_types, type_cast, and simplified_type methods. When are these called? I think I'm still trying to put it all together how each part fits in to the bigger picture. Guessing is usually not a sign of good code :). Thanks for the help on this. Joe
On Wed, Apr 23, 2008 at 11:09 AM, Nick Sieger <nicksieger@...> wrote:
|
|
|
Re: Sqlite 3 adapterI created a ticket to track this under: http://jira.codehaus.org/browse/JRUBY-2438
I believe I have a very good start on the adapter. It passes all of the simple tests except for the column rename which isn't natively supported in SQLite3. I'm pretty sure there is some unused code in the jdbc_sqlite3.rb file. I copied a lot of it from other adapters and tried to piece it together.
I'm pretty unsure of the support for date/time columns. Since SQLite doesn't natively support this I'm storing them as integers which is what the JDBC driver is doing as well. I think this should work ok, it seems like it works. Let me know what else I can do, and if you have any feedback. I attached the patch to the ticket. Thanks.
Joe
On Wed, Apr 23, 2008 at 11:57 AM, Joseph Athman <jjathman@...> wrote: Great. I'll try to clean things up some more tonight and give you a real diff to apply. |
|
|
Re: Sqlite 3 adapterJoseph Athman wrote:
> I created a ticket to track this > under: http://jira.codehaus.org/browse/JRUBY-2438 > > I believe I have a very good start on the adapter. It passes all of the > simple tests except for the column rename which isn't natively supported > in SQLite3. I'm pretty sure there is some unused code in the > jdbc_sqlite3.rb file. I copied a lot of it from other adapters and > tried to piece it together. > > I'm pretty unsure of the support for date/time columns. Since SQLite > doesn't natively support this I'm storing them as integers which is what > the JDBC driver is doing as well. I think this should work ok, it seems > like it works. Let me know what else I can do, and if you have any > feedback. I attached the patch to the ticket. Thanks. How does the driver distinguish between the JNI and NestedVM versions? Does it try to use JNI version first and then fall back on NestedVM? I think in almost all cases we'd want the faster JNI approach where possible; I can't imagine the NestedVM version is fast, but I'd love to be proven wrong. - Charlie --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Sqlite 3 adapterOn Thu, Apr 24, 2008 at 10:30 AM, Charles Oliver Nutter
<charles.nutter@...> wrote: > > How does the driver distinguish between the JNI and NestedVM versions? Does > it try to use JNI version first and then fall back on NestedVM? I think in > almost all cases we'd want the faster JNI approach where possible; I can't > imagine the NestedVM version is fast, but I'd love to be proven wrong. I think it's actually fast enough for now that we only need to ship the nested vm version. We'll have to do more testing to see. I think all you'll need to do to get the JNI version is substitute a different jar. /Nick --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: Sqlite 3 adapterI don't really have any experience using JNI so if that's the direction we want to take I would need some help with it. From my experience it seems like people use SQLite for simplicity instead of speed. From my testing I would agree with Nick that it's "fast enough". People always have MySQL if performance becomes a need.
Is there a good sample Rails app that I could use for some further testing of this? Joe On Thu, Apr 24, 2008 at 10:46 AM, Nick Sieger <nicksieger@...> wrote:
|
|
|
Re: Sqlite 3 adapterGuys this is great! i've been waiting for this.
Would it be possible to get some quick instructions on how to patch this into a JRuby 1.1.1 install? Thanks,
|
|
|
Re: Sqlite 3 adapterMaybe Nick can help you out as far as the best way to patch it, or maybe push out a new version of the gems. Although there is *some* support for SQLite3, I did find that there are issues with Date/Datetime fields with the work I did. According to the SQLite site, it isn't supposed to support Date/Time fields natively, but if you run migrations with the standard Ruby adapter it seems to create them anyways. I'm hoping someone would like to pitch in and help, or at least point me in the right direction. I'm by no means a SQLite expert so I wasn't sure where to go from here.
Not sure how much experience you have with patching and SVN, but here are the basics of how I was doing it. do a checkout of the activerecord code from SVN apply the 2 patches that are attached to the JIRA ticket
Then run these commands: jruby -S rake package jruby -S gem install pkg/*.gem cd drivers/sqlite3 jruby -S rake package jruby -S gem install pkg/*.gem
Hope this gets you started in the right direction. Joe On Thu, May 1, 2008 at 9:23 AM, rob08 <rob99brown@...> wrote:
|
| < Prev | 1 - 2 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |