12.07.2015 Views

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

Solution Guide for Migrating Oracle on UNIX to SQL Server - Willy .Net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

258 Developing: Applicati<strong>on</strong>s — <str<strong>on</strong>g>Migrating</str<strong>on</strong>g> Javadriver installed <str<strong>on</strong>g>for</str<strong>on</strong>g> <strong>SQL</strong> <strong>Server</strong> will install a driver jar file, which c<strong>on</strong>tains driverclasses <str<strong>on</strong>g>for</str<strong>on</strong>g> the database interacti<strong>on</strong>. If the jar file is missing in the classpath, thenthe applicati<strong>on</strong> will flag a 'class not found' excepti<strong>on</strong>.Based <strong>on</strong> the applicati<strong>on</strong>'s architecture, the CLASSPATH must be set. The syntaxof this setting can vary between applicati<strong>on</strong>s, servlets, JSPs, EJBs, and applets.a. For applicati<strong>on</strong>s run directly from the operating system prompt, make sure thatthe driver can be found in the system's CLASSPATH. This can be per<str<strong>on</strong>g>for</str<strong>on</strong>g>medby moving the file <strong>to</strong> its original locati<strong>on</strong>, which is already listed in theclasspath, or adding the driver's current locati<strong>on</strong> <strong>to</strong> the CLASSPATH.b. For applicati<strong>on</strong>s run within the IDE, the driver classpath has <strong>to</strong> be set in thevendor's IDE classpath. Refer <strong>to</strong> your vendor’s IDE documentati<strong>on</strong>.c. For servlets and JSPs run within a servlet/JSP engine such as Tomcat, theclasspath can be set in the vendor's classpath setup screens or by copying thedriver jar file in<strong>to</strong> the LIB folder of the engine’s installati<strong>on</strong>.d. For EJBs, the JDBC driver jar file should also be set in the EJB vendor'sclasspath.e. For applets that run within a Web browser, copy the JDBC driver jar <strong>to</strong> theWeb server root and specify the driver jar file in the applet’s HTML archive tab.The following HTML code example shows this opti<strong>on</strong> used <strong>on</strong> an applet tag.4. If the <strong>SQL</strong> statements passed <strong>to</strong> the JDBC methods use any <str<strong>on</strong>g>Oracle</str<strong>on</strong>g>-specificsyntax, then these items will need <strong>to</strong> be updated <strong>to</strong> reflect T-<strong>SQL</strong> syntax. Migrati<strong>on</strong>of PL/<strong>SQL</strong> <strong>to</strong> T-<strong>SQL</strong> is covered in detail in Chapter 11, "Developing: Applicati<strong>on</strong>s— <str<strong>on</strong>g>Migrating</str<strong>on</strong>g> <str<strong>on</strong>g>Oracle</str<strong>on</strong>g> <strong>SQL</strong> and PL/<strong>SQL</strong>."5. The metadata in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> returned by the metadata methods should refer <strong>to</strong><strong>SQL</strong> <strong>Server</strong> and the new JDBC Driver.To discover in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> about a database, a DatabaseMetaData object must beobtained. ResultSetMetaData provides in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> about the ResultSet, such asnumber of columns returned, an individual column's suggested display size,column names, and column types. If any of these metadata are used in theapplicati<strong>on</strong>, they have <strong>to</strong> be validated <str<strong>on</strong>g>for</str<strong>on</strong>g> integrity of the return values.To discover in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> about a database, a DatabaseMetaData object must beobtained. The getMetaData method <strong>on</strong> the C<strong>on</strong>necti<strong>on</strong> object returns aDatabaseMetaData object.DatabaseMetaData dbmd = c<strong>on</strong>.getMetaData();ResultSetMetaData provides in<str<strong>on</strong>g>for</str<strong>on</strong>g>mati<strong>on</strong> about the ResultSet. Use thegetMetaData method <strong>on</strong> the resultSet <strong>to</strong> get the ResultSetMetaData.ResultSetMetaData rsmd = rs.getMetaData();6. After the applicati<strong>on</strong> changes are complete, create a new release build and fullytest the applicati<strong>on</strong>.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!