Hi

If you using db always from same computer, simply map a drive to the remote database 
when creating the odbc connection in windows..

Otherwise, you will have to install/configure it along with ODBC on each client, but 
it will work.

But if this not a viable solution for you, i think you can't use the jdbc-odbc driver 
because odbc by itself is kinda "local"...

Depend on driver specifications.. for example, when you using jdbc-mysql driver, you 
specify the jdbc url with the host of the machine. (driver connecting directly to bd, 
not via odbc as intermediate...)

If you using dbf tables, maybe you can find some jdbc-dbf drivers..

also, maybe there exists some hints to use the jdbc-odbc driver as you want, but that 
not the normal use..

sorry for my noob english

Hope this help

Kind regards,
__________________________________________________
Antoine Gilbert / [EMAIL PROTECTED] 
Analyst programmer 
 
KOREM
GEObroadcasting Technologies

__________________________________________________
 
680, Charest East Blvd., Suite 120
Quebec (Quebec)
G1K 3J4
Tel.: (418) 647-1555
Fax: (418) 647-1666
1 888 440-1MAP
www.korem.com
__________________________________________________
 
* MapInfo Canadian Partner of the Year - 2001
* Best New MapInfo Partner 2000 - North America
__________________________________________________




-----Message d'origine-----
De : Crompton, Mark [mailto:[EMAIL PROTECTED]]
Envoyé : 15 octobre, 2002 16:33
À : [EMAIL PROTECTED]
Objet : MI-L MapXtreme - JDBC



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


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

Reply via email to