aspose file tools*
The moose likes JDBC and the fly likes JDBC: MySQL vs. SQL Server? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC: MySQL vs. SQL Server?" Watch "JDBC: MySQL vs. SQL Server?" New topic
Author

JDBC: MySQL vs. SQL Server?

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1034
Will JDBC handle the differences betweeen, for example, the way records are "auto-incremented" between MySQL and SQL Server?
For example, if you have code that MySQL likes, you'd have something like:
Insert into table (Field1, field2) VALUES (null, <somevalue>
However, in SQL Server, the syntax is different.
So what I'm asking is whether JDBC will translate the insert statement that you wrote for MySQL so that it will work (without any modifications other than using the SQL Server Driver) with SQL Server?
Thanks very much in advance!
-- Mike
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

Yes and No.
MySQL, with the exception of specialized functions, adheres strictly to ANSI SQL. So no problems there.
MS SQL should adhere to ANSI SQL, and when you say the MS SQL version of that statement is different, I would say that it should still work. However, MS SQL also uses a query language called TSQL (Trasact SQL). So there are some SQL Statements that will work in MS SQL that won't work in MySQL. Also, MS SQL has specialized functions just as MySQL does.
So I say yes, because the same SQL statements, short of special functions, should cary over from MySQL to MS SQL. But no, because the opposit won't always hold true if using TSQL.


GenRocket - A Test Data Generation Platform
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

I should also note that a JDBC driver won't convert one form of SQL into an accepted form per sql server. If it could, then there would only be one Driver implementation for all vendors.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC: MySQL vs. SQL Server?
 
Similar Threads
ejb server provide persistence means ?
Something is wrong in my SQL update
how to do multiple insert
which DBMS to learn ??
What is hibernate dialect, why we are using dialect in hiberate