Sender:  <>
From: (Tristram Scott)
Subject: Re: jdbc with matlab
Newsgroups: comp.soft-sys.matlab
References: <fek8g2$201$>
User-Agent: tin/1.7.7-20041215 ("Scalpay") (UNIX) (SunOS/5.10 (sun4u))
Lines: 49
Message-ID: <2BkPi.28558$>
Date: Thu, 11 Oct 2007 07:50:22 GMT
X-Trace: 1192089022 (Thu, 11 Oct 2007 08:50:22 BST)
NNTP-Posting-Date: Thu, 11 Oct 2007 08:50:22 BST
Organization: NTL
Xref: comp.soft-sys.matlab:432370

Steven  <> wrote:
> I want to use a sql server to store matlab data. I
> downloaded sql express from microsoft and set it up. I also
> set up jdbc to use with sql express and matlab. I went
> through the help file and added the classpath ect. I am now
> trying to connect to the database and have proved
> unsuccesful, I get this message every time I try and
> connect: Invalid connection
> conn = database('pubs','guest','******',...
> '',...
> 'jdbc:sqlserver://localhost:1433');
> ping(conn);
> I have tried both the querybuilder and the above code and
> neither seem to work. I have two questions, Has anyone
> successfully implemented jdbc with sql express? 

I haven't used sql express, but SQLServer has worked for me in the past.

I used code something like this:

dbsrc = 'waltons'; % Datbase source
dbuser = 'bob'; % Database User
dbpass = 'jimbob'; % Database password
dbdrv = '';
dburl = 'jdbc:microsoft:sqlserver://sqlhost:1433;database=waltons';

dbConn = database(dbsrc,dbuser,dbpass,dbdrv,dburl); % Connect

I notice that you don't have the m word in your url.  I think it might be
necessary to write it down on this occasion, but you don't have to say it
out loud.

I specified the database in the url because the server ran more than one,
and didn't always do the correct thing.  

> And is there
> a simple way I be able to test the jdbc to ensure that the
> server works properly before I connect to matlab?

I guess you could follow the Java examples, since it is Java dbc.  I recall
looking through the jdbc documentation once and finding it to be quite

Dr Tristram J. Scott               
Energy Consultant