I believe (i do it through access how different can it be) you have to set up and ODBC link to the SQL database.
Some sample code below
Now please bear in mind I am a complete novice and teaching myself. But fo Access this works. I have tested it against SQL and it works too when data migration done.
Connection conn;
boolean dbOpen;
openDatabase()
{
int result = 0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"

;
conn = DriverManager.getConnection("JDBC:ODBC:newmar","admin",""

;
}
catch(SQLException ex)
{
System.out.println("excp"

;
System.out.println ("\n*** SQLException caught ***\n"

;
while (ex != null)
{
System.out.println ("SQLState: " +
ex.getSQLState ());
System.out.println ("Message: " + ex.getMessage ());
System.out.println ("Vendor: " +
ex.getErrorCode ());
ex = ex.getNextException ();
System.out.println (""

;
result++;
}
}
catch(Exception ex)
{
System.out.println(ex);
System.out.println("open Fail"

;
result++;
}
if (result > 0)
{
dbOpen = false;
}
else
{
dbOpen = true;
}
I am sure you will get the jist. I sort of jigglrd it from sun web site on JDBC pretty good stuff. Tells you how to retrieve and place data. Again I am not a SQL expert and am using simple SQL statements..