There are some samples in that zip file as well. Then it was just a matter of writing a bit of code:
package comuniversalmetalsmvbase; import com.tigr.mvapi.MVConnection; import com.tigr.mvapi.MVConstants; import com.tigr.mvapi.MVStatement; import com.tigr.mvapi.ResultSet.MVResultSet; import com.tigr.mvapi.exceptions.MVException; import java.util.Properties; /** * * @author arash */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { Properties props = new Properties(); props.setProperty("username", "MVSP"); props.setProperty("password", ""); String url = "jdbc:mv:mvbase:192.168.1.5:9010"; String account = "SYSPROG"; String AM = MVConstants.AM; String query; MVConnection connection = null; try { connection = new MVConnection(url, props); /** * Execute a query and display the results: */ MVStatement mvStatement = connection.createStatement(); connection.logTo(account, ""); // query = "LIST CUSTOMERS (I"; //boolean result = mvStatement.execute(query); //MVResultSet results = mvStatement.getResultSet(); MVResultSet results = mvStatement.executeQuery("PEOPLE", "", "", "FIRST-NAME"); while (results.next()) { String row = results.getCurrentRow(); System.out.println(row); } } catch (MVException e) { System.out.println(e.toString()); } finally { if (connection != null) { try { connection.close(); } catch (MVException e) { e.printStackTrace(); } } } } }
I am trying to use d3 database with java Api MVSP
ReplyDeletei have download the mvapi.jar and keeping the above code as reference ,the only change i did is
with username and password ,account .But when i am trying to run the program getting com.tigr.mvapi.exceptions.MVException: server error with errorCode 1023. i check the console but not able to figure out the actual cause.
please suggest where i am doing wrong.
Post inquiries about MVSP to the TigerLogic forum, or contact the site's VAR. If they don't know, look for anyone in forum talking about MVSP and get them to work with the VAR. If you can't see the TL forum see the Google Group "MVDBMS".
ReplyDeleteMVSP out of the box doesn't work with connection pooling. My project https://github.com/asharif/mv-session-mgr does.
Delete