xml spy
Previous  Top  Next

JDBC driver setup


JDBC drivers have to be installed for you to compile Java code when mapping database data. They are not needed for using the MapForce engine or if you generate code for C++ or C#.

 

Overview

This section describes how to download and install JDBC drivers and how to use them with Ant and JBuilder. A JBuilder project file and Ant build scripts are generated by MapForce when generating Java code.

 

JDBC drivers are used by MapForce generated Java applications to connect to, and exchange data with several different databases. These JDBC drivers need to be installed first, to successfully run the generated Java application(s).

 

In general JDBC drivers can be found at http://industry.java.sun.com/products/jdbc/drivers

 

MapForce generated Java applications were tested with the following JDBC-drivers:

 

MS Access
MSSQL2000
Oracle 9i
MySQL
Sybase
IBM DB2

 

This section assumes the following:

the reader is familiar with setting Java CLASSPATHs
Java SDK and Ant, or JBuilder is already installed and is working correctly
at least one of the databases described below is running and the minimum privilege - read-only, is granted

 


MS Access

The JDBC-ODBC-bridge is already installed with Java SDK.

 

Java internal usage

       Driver

sun.jdbc.odbc.JdbcOdbcDriver

       URL

jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ=Sourcename...

 


Microsoft SQL Server 2000

Download from http://www.microsoft.com/sql/

 

Ant Settings

Please make sure that the following jar file entries are in the CLASSPATH:

 

C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for  JDBC\lib\mssqlserver.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar

 

assuming that "C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC" was your installation folder.

 

JBuilder Settings

Use the menu option Tools | Configure JDKs... then click Add to add all the jar files listed above.

 

Java internal usage

       Driver

com.microsoft.jdbc.sqlserver.SQLServerDriver

       URL

jdbc:microsoft:sqlserver://localhost

 


Microsoft SQL Server 2005 JDBC driver 1.1

Download the Microsoft SQL Server 2005 JDBC Driver from the Microsoft website. http://www.microsoft.com/downloads/details.aspx?FamilyID=6d483869-816a-44cb-9787-a866235efc7c&DisplayLang=en

 

Assuming you extract the downloaded zip archive to C:\, please make sure that the following jar file entry is in the CLASSPATH:

 

C:\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu\sqljdbc.jar

 

JDBC specific settings in Mapforce:

NOTE:  Mapforce will automatically add the JDBC Driver and Databse URL settings that would be used for the MS SQL 2000 JDBC connection even if you connect to a MS SQL 2005 server, so these must be changed before generating Java code!

 

Using 2000 JDBC:

JDBC Driver:

com.microsoft.jdbc.sqlserver.SQLServerDriver

Database URL:

jdbc:microsoft:sqlserver://localhost

 

 

Using 2005 JDBC:

JDBC Driver:

com.microsoft.sqlserver.jdbc.SQLServerDriver

Database URL:

jdbc:sqlserver://PRIVSQL05;DatabaseName=mydb_13031;SelectMethod=Cursor;

 

If you use the integrated windows authentication method to connect to your SQL 2005 server, you have to add integratedSecurity=true to your Database URL.

 

e.g.

jdbc:sqlserver://PRIVSQL05;DatabaseName=mydb_13031; integratedSecurity=true; SelectMethod=Cursor;

 

If you are using the integrated Windows Authentication to connect to the MS SQL 2005 database it will also be necessary to use sqljdbc_auth.dll depending on the type of machine, 32 bit or 64 bit, and then place this DLL into your Windows System path i.e. Windows/System32.

 

sqljdbc_auth.dll can be found at the locations shown below if you extracted the ZIP file to C:\.

C:\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu\auth\x86 x86 version.

 

or,

 

C:\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu\auth\x64 x 64 bit version.

 

If you do not use the integrated Windows Authentication, i.e. you are connecting to the database using a database username and password, then you can enter the user name and password into the Generic Database Settings dialog (in this case you would leave integratedSecurity=true out of the Database URL). Double click the database component to open this dialog box.

 

sql-serv2005-1

 


Oracle 9i

Download the Oracle9i Release 2 (9.2.0.3) driver for JDK 1.4: ojdbc14.jar

from http://otn.oracle.com/software/tech/java/sqlj_jdbc

You will need to have an account, or sign up to the Oracle Technology Network to access these drivers.

 

Ant Settings

Add the full path to ojdbc14.jar to the CLASSPATH.

 

JBuilder Settings

Use the menu option Tools | Configure JDKs... then click Add to add the jar file above.

 

Java internal usage

       Driver

oracle.jdbc.OracleDriver

       URL

jdbc:oracle:oci:@localhost

 


Previous  Top  Next

© 2008 Altova