|
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
|