Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: jdbc with matlab

Subject: jdbc with matlab

From: Steven

Date: 11 Oct, 2007 04:23:30

Message: 1 of 3

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




Subject: jdbc with matlab

From: tristram.scott@ntlworld.com (Tristram Scott)

Date: 11 Oct, 2007 07:50:22

Message: 2 of 3

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

Subject: jdbc with matlab

From: Karan

Date: 18 Dec, 2007 08:07:28

Message: 3 of 3

I dont think SQL express works with the string

'com.microsoft.jdbc.sqlserver.SQLServerDriver'

Any ideas on how one could modify this string to work for
sql server express?

"Steven " <burrguy.athotmailnot@msn.com> wrote in message
<fek8g2$201$1@fred.mathworks.com>...
> 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? 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?
>
>
>

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
jdbc Steven 11 Oct, 2007 00:25:05
sql express Steven 11 Oct, 2007 00:25:05
sql Steven 11 Oct, 2007 00:25:05
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics