UPDATE: This repo is obsolete it's replaced by https://github.com/asharif/mv-session-mgr
Created a new project to attempt to be connecting to mvBase in a uniform JDBC compliant way. It also handles multiple threads as the original MVSP connectors don't somehow...(yikes!)
Check it out:
https://github.com/asharif/mv.jdbc
Tuesday, June 28, 2011
Tuesday, June 14, 2011
Connecting to mvBase 3.0 with Java
A couple posts back I went through the basics of PICK (mvBase). I finally got a chance to connect to it using the mvBase 3.0 MVSP with Java. First off we need the mvapi.jar which acts as our jdbc like interface (UPDATE: MVSP alone is actually hard to use in a web app as it does not handle any connection pooling and basically only allows one active connection at a time. It also doesn't work in a standard JDBC compliant manner which is why I started a project https://github.com/asharif/mv-session-mgr). I downloaded it off the tigerlogic ftp site ftp://ftp.tigerlogic.com/pub/MVSP/Java/
There are some samples in that zip file as well. Then it was just a matter of writing a bit of code:
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();
}
}
}
}
}
Tuesday, June 7, 2011
Grails Spring Security & Ldap Plugins
So I had to implement a user authentication + role based system at work. Sounded like a perfect fit for Spring Security and the LDAP Grails plugins. Unfortunately they weren't that straight forward at the time. Since then I updated the official docs. See the link:
http://burtbeckwith.github.com/grails-spring-security-ldap/docs/manual/index.html
http://burtbeckwith.github.com/grails-spring-security-ldap/docs/manual/index.html
Subscribe to:
Comments (Atom)