File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Android Security Essentials Live Lessons this week in the Android 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: 1043
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: 15299
    
    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 - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JDBC: MySQL vs. SQL Server?
 
Similar Threads
how to do multiple insert
What is hibernate dialect, why we are using dialect in hiberate
Something is wrong in my SQL update
ejb server provide persistence means ?
which DBMS to learn ??