when using java.sql classes

when using java.sql classes , is it needed that SQL or MySQL server be running or does java.sql provide all needed functionality. If the answer is that server be running, are SQL and MYSQL interchangable. Thanks in advance. PL
[241 byte] By [pal_pontiac89a] at [2007-11-27 6:16:54]
# 1
The classes in the SQL package allow you to connect to a database. It is not a database in itself. So you would need to have a version of a database available.
floundera at 2007-7-12 17:29:06 > top of Java-index,Java Essentials,Java Programming...
# 2
and no the database's aren't really interchangable but the Java code you write will be [for the most part] but there will be differences in sql syntax.
prob.not.sola at 2007-7-12 17:29:06 > top of Java-index,Java Essentials,Java Programming...
# 3

> and no the database's aren't really interchangable

> but the Java code you write will be [for the most

> part] but there will be differences in sql syntax.

Considering one is a database and the other is a language to query the database, no they wouldn't interchangeable.

floundera at 2007-7-12 17:29:06 > top of Java-index,Java Essentials,Java Programming...
# 4

> > and no the database's aren't really interchangable

> > but the Java code you write will be [for the most

> > part] but there will be differences in sql syntax.

>

> Considering one is a database and the other is a

> language to query the database, no they wouldn't

> interchangeable.

i think by 'sql' he means 'mssql'.

prob.not.sola at 2007-7-12 17:29:06 > top of Java-index,Java Essentials,Java Programming...
# 5

Thanks Flounder for answering first part of question, but i have MySQl and not SQL so am wondering if java.sql will work with MySQL. would appreciate further answer but guess I can always just try it and see for myself. Thanks again.

PL

P.S. Guessing you are Animal House fan. One of my alltime favorites. Some of Belushi's best moments on film.

pal_pontiac89a at 2007-7-12 17:29:06 > top of Java-index,Java Essentials,Java Programming...
# 6

> Thanks Flounder for answering first part of question,

> but i have MySQl and not SQL so am wondering if

> java.sql will work with MySQL. would appreciate

> further answer but guess I can always just try it

> and see for myself. Thanks again.

yes you can try and yes it will work with mysql; you will need to download the mysql jdbc driver though, it's on their site.

there is a cottony db guru around here somewhere that will be happy to help you, if you help yourself.

prob.not.sola at 2007-7-12 17:29:06 > top of Java-index,Java Essentials,Java Programming...
# 7

Thanks to you also Prob.Not.Sol ,

I will go get that jdbc driver and give it a whirl. And by the way , i am new to tinkering with databases so when I refer to SQL and MySQL, I am basically referring to their abilities to query databases . I think MySQL is both a query language and a database, but the actual database I am using is Access and it is my understanding that I can pretty much use any relational database. Thanks again

PL

pal_pontiac89a at 2007-7-12 17:29:06 > top of Java-index,Java Essentials,Java Programming...
# 8

> Thanks to you also Prob.Not.Sol ,

> I will go get that jdbc driver and give it a whirl.

> And by the way , i am new to tinkering with

> databases so when I refer to SQL and MySQL, I am

> basically referring to their abilities to query

> databases . I think MySQL is both a query language

> and a database, but the actual database I am using

> is Access and it is my understanding that I can

> pretty much use any relational database. Thanks

> again

no,

SQL is a query language for talking to databases.

MySQL, MSSQL, and MS Access are all databases, that understand varying versions of the 'SQL' language.

prob.not.sola at 2007-7-12 17:29:06 > top of Java-index,Java Essentials,Java Programming...
# 9

> databases . I think MySQL is both a query language

> and a database,

Err not really. MySQL is a database. It uses SQL. As mentioned previously databases have their own dialects for some queries but the general basics are the same from database to database. SQL.

> but the actual database I am using

> is Access and it is my understanding that I can

> pretty much use any relational database.

Yes.

But the mysql driver will not be of much help in connecting to an Access database. For that you'll need the JdbcOdbcBridge driver which Sun already has given you.

You seem a bit confused so just to recap.

the java.sql package is a collection of interfaces that describe how access to databases happens in Java. Collectively the java.sql package (and the javax.sql package which is sort of advanced database-y stuff) make up JDBC.

But interfaces are just that. Interfaces. There is no code there that actually does anything. For the code that does something you need an implementation, and this is where the drivers come in. JDBC drivers whcih come from a variety of sources: Sun, the database vendor, companies who make and sell drivers and free open source projects provide the actual implementation of the java.sql interfaces specific to a particular database.

Hopefully I haven't lost you at this point...

Here's the important thing. If you want to connect to database X (which could be MySQL, Oracle, DB2, MS-SQL or yes Virginia even Access) you need the driver that will support the connection to that database.

So again if you are using MySQL then get the MySQL driver. If you are using Access then you'll be using the JdbcOdbcDriver. But you can't mix and match databases and drivers.

cotton.ma at 2007-7-12 17:29:06 > top of Java-index,Java Essentials,Java Programming...