Hi Hans,
Yes, you can use the IP address of the server and you don't have to specify the port number if you use the default port ( = 3306 in case of MySQL).
database = catalog = a namespace within the server
This code example shows you how to perform a full structure search with MySQL database:
using ChemAxon.NET.IKVM.DB;
using ChemAxon.NET.API;
using ChemAxon.NET.IKVM.DB.Entities;
using ChemAxon.NET.IKVM.Chemistry;
using ChemAxon.NET.Base.Search.Options;
public void FullStructureSearchWithMySqlExample()
{
string host = "10.0.0.21";
int port = 3306;
string db = "JCHEMSQL_API_TEST";
string userName = "jchem";
string password = "jchem";
//Connect to the database
IConnectionInfo connection = MainFactory.Database.CreateConnection(host, port, db, userName, password, DBType.MySQL);
string jchemPropertiesTable = "jchemProperties";
IJChemDatabaseHandler database = MainFactory.Database.OpenJChem(connection, jchemPropertiesTable);
//Get structure table from the database
string structureTableName = "molecules";
IEnumerable<IJChemTable> tables = database.GetTables();
IJChemTable structureTable = tables.First(table => table.Name == structureTableName);
//Create search parameter
IJChemMolecule queryMolecule = MainFactory.Chemistry.CreateMolecule("CCCC");
IJChemMoleculeFilter filter = MainFactory.Database.CreateJChemMoleculeFilter(queryMolecule);
filter.SearchOption.SearchType = JChemSearchTypes.Full;
//Get filtered molecules
IEnumerable<JChemDBMolecule> filterResult = structureTable.GetMolecules(filter);
//Show results
foreach (JChemDBMolecule molecule in filterResult)
{
Console.WriteLine(molecule.Formula);
}
}
Regards,
Miklos