eclipse - Iterate Sql.result set -


i need create owl class first table name if cardinality 1:1 , owl class second table name. if cardinality 1:* , 1 of tables describes object properties, create owl object property first table name, create owl class second table name. first of how can create class column names? have owl api installed in eclipse.

public class snippet {

public static void main(string[] args) {       //  sql server db jdbc      string url = "jdbc:sqlserver://isd.ktu.lt:1433";      string databasename= "xxxx";      string username = "xxx";      string password = "xxx";      try {         class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver");         connection con = drivermanager.getconnection (url, username, password);         statement smt = con.createstatement();         smt.executequery("select * table_references");         resultset rs = smt.getresultset();          while (rs.next()) {              string column1 = rs.getstring("referenced_object_id");             string column2 = rs.getstring("name");             string column3 = rs.getstring("parent_column_id");             string column4 = rs.getstring("referenced_column_id");              system.out.println(column1 + " | " + column2 + " | " + column3 + " | " + column4);         }     catch (classnotfoundexception e) {         // todo auto-generated catch block         e.printstacktrace();     } catch (sqlexception e) {         // todo auto-generated catch block         e.printstacktrace();     }      //  protege api  } 

}

you use while (rs.next()) { rs.getstring("columnname"); }


Comments

Popular posts from this blog

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

Why does PHP consider 0 to be equal to a string? -

formula - R: how to pass in a reference to the variable in glm or lm? -