Re: SQLSever JDBC datatypes

  • From: Nick Sieger <nicksieger@gmail.com>
  • To: "Graff, Carl" <cgraff@chatsworth.com>, dev@activerecord-jdbc.kenai.com
  • Subject: Re: SQLSever JDBC datatypes
  • Date: Tue, 24 Feb 2009 17:47:55 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=SvpNaFVqysHLd99Pgpvwx9Ml8V4zsWNZ7Hcxq+0tnyW7WxsNuyYMzpFF4M7F0/kV9U FKc8UmCK3Cq7UZJTs899FqSqZ1I+G4PCPgtSyAxQ+5V858ybF1+F7zskaAgghGJ6+t+d W+Drp8kuJm1lbNw3mixws2fDq01QCwbjlfesA=

Hey Carl,

On Mon, Feb 23, 2009 at 5:21 PM, Graff, Carl <cgraff@chatsworth.com> wrote:
Hello Nick,

First thank you for the great stuff you and your partners keep cranking out.

Second if you would rather I post this to a forum please just let me know
the best one.

I'm copying dev@activerecord-jdbc.kenai.com; please subscribe and post
any follow-up there for public discussion, thanks!

I have been using composite_primary_keys with cruby and standalone
ActiveRecord (outside of rails) with great success for about two years with
a very large SQL Server based ERP schema. I even call stored procedures with
the aid of a little library from “Made of Stone”.

I really  like NetBeans and the Glassfish/OpenSOA and I am especially
looking forward to the Fuji release. I would like to base our companies ESB
SOA architecture on this eventually migrating to the Sun supported versions.

In order to take full advantage of this I think it is best to swicth from
CRuby to JRuby (so I can leverage Ruby based stuff in Fuji) … but … using
the latest Microsoft SQL Server 2005 JDBC Driver sqljdbc4.jar I notice some
anomalies in the data types. In particular FIXNUM type seem to be converted
to string and this statement:

class AdHocQuery < ActiveRecord::Base
end

Had to be modified to specify a dummy table and PK even though only use
AdHocQuery for find_by_sql calls as follows:

class AdHocQuery < ActiveRecord::Base
  set_table_name "pc_throttle"
  set_primary_key :table_name
end

I think I can code around the FIXNUM to String data type issue and the
addition of the dummy table and PK to AdHocQuery probably won’t affect that
much. I have yet to try the Stored Procedure calls and if things “bow-up”
that is probably where it will happen.

So if you know anything about the FIXNUM conversion to strings or if waiting
for a later release of the JDBC driver might help please let me know.

BTW – here is how I am connecting to the database:

ActiveRecord::Base.establish_connection(
  :adapter  => 'jdbc',
  :driver => 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
:url => 'jdbc:sqlserver://localhost\\dbo: 1433;databaseName=mydatabase',
  :username => @dbuser, :password => @dbpswd, :host => @dbserv)

Does this seem appropriate? Thought the “\\dbo” a little odd but seems to be
needed.

My suggestion at this point is to pull activerecord-jdbc-adapter
source and try running those tests with MS SQL. Assuming you add the
sqljdbc4.jar to the classpath, you should just be able to run "jruby
-S rake java_compile test_mssql" inside the top directory of the
project. See the README.txt file for details on running the tests, or
of course you can reply here with questions.

/Nick



Re: SQLSever JDBC datatypes

Nick Sieger 02/25/2009
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close