Is there a Java expert that can show me how to open a JDBC connection to a server?  
Below is the simple code that works to read a DB file on the local computer.  What I 
am trying to do is read it from a server - the same web server MapXtreme is running on.

To explain a little, because MapXtreme is so slow I have moved most of the data out of 
the TAB file into .DBF file (could be Access DB or other none Spatial DB).  A 
particular object location is read from MapXtreme and then the DB file is referenced 
for the data (could be 1000's of records where the TAB file is way smaller).  The 
strSite and strTableName variables are passed from the MapXtreme portion.  


Now this works if 'DATAFILE' is local (or the whole thing is run on the server), what 
I am looking for is an ODBC/JDBC connection that references a server.  Is that 
possible or am I running into the realms of RMI?  Alternatives I have looked at are 
copying these DBF files to the local hard disk, but that would prevent the application 
from running as an applet if so desired.

Are there any samples of:  com.mapinfo.dp.jdbc out there?  Any ideas?

Thanks
Mark Crompton
Nextel RF Technology Manager, West Region


**************************************************************************************
import java.sql.*;

public class ReadODBC
{
        public static void main (String[] args)
        {
                Statement ODBCstmt;
                Connection ODBCcon;
                String strSite = "5018";
                String strTableName = "DATAFILE";
                ResultSet rs;
                ResultSetMetaData rsmd;
                String strQry = "";

                try                                                     // Load the 
jdbc-odbc bridge driver
                {
                        Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
                        ODBCcon = DriverManager.getConnection ( "jdbc:odbc:ULDATAdbf" 
, "", "");
                        ODBCstmt = ODBCcon.createStatement ();

                        rs = ODBCstmt.executeQuery ("Select * from " + strTableName);
                        rsmd = rs.getMetaData();

                        strQry = "Select * from " + strTableName + " where 
"+rsmd.getColumnName(1)+" = '"+strSite+"'";
                        rs = ODBCstmt.executeQuery (strQry);
                        while (rs.next()) 
                        {
                                System.out.println(strSite+" " + rs.getString(2) + " 
"+ rs.getString(3));
                        }
        
                        ODBCcon.close();
                }
                catch (Exception ex) 
                {
                        ex.printStackTrace ();
                }
        }
}

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 3595

Reply via email to