Accessing an SQL server database using the SQL library

Hi, I am new to Processing and this forum. I couldn’t find any other posts on this so if this is an old question, please provide a link to the answer. Can you use the SQL library to access an SQL Server database? The library lists MySql access. If so, what modifications would be needed? Thank you.

1 Like

Are you running in the back end or are you accessing as a client? Or you want to do a get/post request? If the latter, do you have already a layer that allows you to interact with your DB?

This is next post is not a MsSQL but a java DB (Derby so I understand from the post): It does not answer your post but I added more for future reference.


1 Like

Thanks Kf, I am just starting this project. The goal is to use serial communications between a pc and an Arduino board. This step has been accomplished. Next step is to establish this serial communication through a bluetooth connection. I just got the HC05 so that is still to be done. Once the communication has been established, I want to also interface with a database where command codes can be stored. Commands could then be accessed through the pc and sent to the arduino. This is still in the planning stages but this would allow a user friendly remote command interface to a robot where the commands could be updated without reprogramming the arduino directly. It is ambitious and will have to be thought out in detail once the basic communication and access are established. The link you provided looks promising. Thanks again.

I looking for MSSQL lib too. Not success! :disappointed:

@miasoft Why did you try? I good place to start would be this

I have tested creating and reading an MySQL using Processing. For MSSQL, you will need to setup the environment which I don’t have atm.


I did accessing MSSQL exfmple. All Ok.

Here is source code for Processing

// Example from MIASOFT ( 
// Example created on 2019-02-22 by Powder
// Tested with Processing 3.5.3 + JDK 1.8 + sqljdbc42.jar(MSSQL2008r2). Win7x32 
// my classpath for jdbc driver:  CLASSPATH=C:\sqljdbc_4.2\enu\jre8;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;

int count;
boolean keypress=false;
Connection con = null;
Statement stmt = null;
ResultSet executeQuery= null;
String JDBC_URL = "jdbc:sqlserver://tycoon\\SQL2008r2;databaseName=Abitur;user=sa;password=xxxxx;";

void setup() { 
    text("Click mouse or any key", (width/2), height/2);
    text("(see result in console)", (width/2), height/2+40);

  void draw(){
    if ( keypress == true) {
      println("==========  count = "+count+"  =============");
       try {
            con = DriverManager.getConnection(JDBC_URL); 
            stmt = con.createStatement();
            executeQuery = stmt.executeQuery("SELECT * FROM DummyStr");
            // set of data and then display it.
            while ( {
                System.out.println(executeQuery.getString("Str"));  // field name "Str" (DummyStr.Str)
            // from another table 
            executeQuery = stmt.executeQuery("SELECT * FROM Lgoty");
            // set of data and then display it.
            while ( {
                System.out.println(executeQuery.getString("Shortname"));  // field name "Shortname" (Lgoty.Shortname)
         } catch (SQLException ex) {
           // Handle any errors that may have occurred
           println("exception:  " +ex);
        finally {
          println("==========  close all ============");
         if (executeQuery != null) try { executeQuery.close(); } catch(Exception e) {}
         if (stmt != null) try { stmt.close(); } catch(Exception e) {}
         if (con != null) try { con.close(); } catch(Exception e) {}
void keyPressed() {
       keypress = !keypress;

void mousePressed() {
       keypress = !keypress;

1 Like