Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!news-fra1.dfn.de!newsfeed.velia.net!news.tiscali.de!newsfeed.freenet.de!feeder.news-service.com!tudelft.nl!txtfeed1.tudelft.nl!feed.xsnews.nl!border-1.ams.xsnews.nl!68.142.88.75.MISMATCH!hwmnpeer01.ams!news-out.ntli.net!newsrout1-gui.ntli.net!ntli.net!news.highwinds-media.com!newspeer1-win.ntli.net!newsfe2-gui.ntli.net.POSTED!53ab2750!not-for-mail
Sender:  <tristram@chicken.ntlworld.com>
From: tristram.scott@ntlworld.com (Tristram Scott)
Subject: Re: jdbc with matlab
Newsgroups: comp.soft-sys.matlab
References: <fek8g2$201$1@fred.mathworks.com>
User-Agent: tin/1.7.7-20041215 ("Scalpay") (UNIX) (SunOS/5.10 (sun4u))
Lines: 49
Message-ID: <2BkPi.28558$aN2.1257@newsfe2-gui.ntli.net>
Date: Thu, 11 Oct 2007 07:50:22 GMT
NNTP-Posting-Host: 82.6.105.52
X-Complaints-To: http://netreport.virginmedia.com
X-Trace: newsfe2-gui.ntli.net 1192089022 82.6.105.52 (Thu, 11 Oct 2007 08:50:22 BST)
NNTP-Posting-Date: Thu, 11 Oct 2007 08:50:22 BST
Organization: NTL
Xref: news.mathworks.com comp.soft-sys.matlab:432370


Steven  <burrguy.athotmailnot@msn.com> 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','******',...
> 'com.microsoft.jdbc.sqlserver.SQLServerDriver',...
> '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 = 'com.microsoft.jdbc.sqlserver.SQLServerDriver';
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
good.

-- 
Dr Tristram J. Scott               
Energy Consultant