Problem with Exception in query substructure

User 7fc1506f44

11-12-2012 18:30:51

I'm having a problem query by substructure, when I do the query returns the error below error:



my code below :


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */




import org.mentawai.core.ApplicationManager;
import org.mentawai.db.*;
import chemaxon.formats.MolFormatException;
import chemaxon.jchem.db.DatabaseSearchException;
import chemaxon.jchem.db.*;
import chemaxon.jchem.db.PropertyNotSetException;
import chemaxon.sss.SearchConstants;
import chemaxon.sss.search.JChemSearchOptions;
import chemaxon.util.ConnectionHandler;
import java.io.IOException;
import java.sql.*;
import java.sql.DriverManager;
import java.sql.SQLException;
import org.mentawai.db.DBCPConnectionHandler;
import sun.jdbc.odbc.ee.ConnectionPool;

/**
 *
 * @author KAYAMEN
 */





public class SistematXSubConsulta {

    private Connection connection;

    public void consultaSubEstrutura() throws ClassNotFoundException, SQLException {





    }

    public static void main(String[] args) throws ClassNotFoundException, SQLException, MolFormatException, IOException, DatabaseSearchException, PropertyNotSetException, InstantiationException, IllegalAccessException {




        SistematXSubConsulta cc = new SistematXSubConsulta();
        cc.consultaSubEstrutura();


        String driverName = "org.gjt.mm.mysql.Driver"; //MySQL MM JDBC drive
        Class.forName(driverName);
        String serverName = "127.0.0.1";
        String mydatabase = "sistemat";
        String url = "jdbc:mysql://" + serverName + "/" + mydatabase; // a JDBC url
        String username = "root";
        String password = "";
        Connection connection = DriverManager.getConnection(url, username, password);
        String propertyTableName = "BCOMP";

        ConnectionHandler ch;


        //In case of a new login
        ch = new ConnectionHandler();
        ch.setDriver(driverName);
        ch.setUrl(url);
        ch.setLoginName(username);
        ch.setPassword(password);
        ch.setPropertyTable(propertyTableName);



        String mol = "

ChemAxon 9c0afc9aaf

11-12-2012 19:36:10

Hi,


There is no active DB connection in your ConnectionHandler.


Please call ch.connectToDatabase() to connect to the database before using it.


http://www.chemaxon.com/jchem/doc/dev/java/api/chemaxon/util/ConnectionHandler.html#connectToDatabase()


Best regards,


Szilard