• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JDBC: MySQL vs. SQL Server?

 
Bartender
Posts: 1973
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Attractive, successful people love this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic