Connect to MS Sql Server from Java Source

Hi,
Is there any way I could connect to ms sql server from Java source? I know I can call java source from function thats easy but what I really want is capability to connect to non-oracle(MS SQL server) from my java source and then call it from function.
I don't know if JDBC driver for SQL server is even installed/available. Is there a way I could find it out form my IDE? I know sqlJ does compile but I have never used sqlj. help!!!
Sinha

You'll probably have better luck in a Java forum or a Microsoft forum.

Similar Messages

  • How to connect to a Sql server from Oracle using db link

    Hi All,
    Does anybody have any idea about how to connect to a sql server from oracle database using db link to syncronize the data? I need to pull the data from Sql server table to Oracle tables and relay messages back to the sql server.
    Thank you,
    Praveen.

    we have 2 products - DG4MSQL and DG4ODBC.
    DG4ODBC is for free and requires a 3rd party ODBC driver and it can connect to any 3rd party database as long as you use a suitable ODBC driver
    DG4MSQL is more powerfull as it is designed for MS SQL Server databases and it supports many functions it can directly map to SQL Server equivalents - it can also call remote procedures or participtae in distributed transactions. Please be aware DG4MSQL requires a license - it is not for free.
    Check out Metalink and you'll find notes how to configure both products.
    For a generic overview:
    Note.233876.1 Options for Connecting to Foreign Data Stores and Non-Oracle Databases
    And the setup notes:
    DG4ODBC
    Note.561033.1 How to Setup DG4ODBC on 64bit Unix OS (Linux, Solaris, AIX, HP-UX) :
    Note.466225.1 How to Setup DG4ODBC (Oracle Database Gateway for ODBC) on Windows 32bit RDBMS.HS-3-2 :
    Note.109730.1 How to setup generic connectivity (HSODBC) for 32 bit Windows (Windows NT, Windows 2000, Windows XP, Windows 2003) V817:
    Note.466228.1 How to Setup DG4ODBC on Linux x86 32bit
    DG4MSQL
    Note.466267.1 How to Setup DG4MSQL (Database Gateway for MS SQL Server) on Windows 32bit
    Note.562509.1 How to Setup DG4MSQL (Oracle Database Gateway for MS SQL Server) 64bit Unix OS (Linux, Solaris, AIX,HP-UX)
    Note.437374.1 How to Setup DG4MSQL (Oracle Database Gateway for MS SQL Server) Release 11 on Linux

  • Connecting to network SQL Server from SQL Developer

    Hi All,
    I am trying to connect to network SQL Server from SQLDeveloper but I am unable to connect( I am getting could not connect to SQL Server...). I have searched many sites but could not find the solution. I am giving HostName as MachineName\InstanceName and keeping the port as 1433.
    Can anyone explain how that connection string should be given.
    Thanks.

    From help with additional comments
    Host Name: Host system for the Microsoft SQL Server or Sybase Adaptive Server database.
    E.g., sybase.myCompany.org (DNS name or IP address)
    Port: TCP/IP Port on which Microsoft SQL Server or Sybase Adaptive Server will listen.
    As mentioned by others, need to know how server is configured. Common values: 1433, 5000
    Retrieve Database: Name of the Microsoft SQL Server or Sybase Adaptive Server database.
    Once the other data is correct, press this to populate list box and select which database you want associated with this connection. E.g., pixar, pubs2, etc.
    Brian Jeffries
    SQL Developer Team

  • Connect to MS SQL server from OWB on Linux platform

    Hi,
    I want to connect to MS SQL server through OWB, on Linux platform.
    I suppose I would use JDBC driver, and Heterogeneous services. Is that possible?
    I did not see anything on JDBC driver for MS SQL server for Linux platform from Oracle.
    Also, I was wondering is Oracle Gateway 10g for Linux a way to connect to MSSQL server?
    Any leads would be appreciated.
    Thanks
    Ani

    Hi,
    This quite an actual topic for myself, so I decided to take some time to collect some information.
    Start at:
    * Oracle Generic Connectivity and Oracle Transparent Gateway - http://www.oracle.com/technology/products/gateways/gateways_fov.html
    You can use the free Heterogenous Services component named Generic Connectivity for connecting to SqlServer over ODBC. You will need to find (or purchase?) a third-party ODBC driver for SqlServer for Linux, e.g. from www.datadirect.com. Setting this up will allow you to define a databaselink to the SqlServer. Open Gateways implements a limited set of the oracle SQL, so you will have to find out what is possible and what not.
    See also:
    * How To Setup HSODBC on Linux - https://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=264567.1
    * Generic Connectivity Available on Linux x86 with 10g - https://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=261726.1
    You can also use the Transparent Gateway for SqlServer (HS), which is about EURO 12000 per computer(!). This gives you a full implementation of Oracle SQL and you can access the SqlServer like it was Oracle.
    You can also install Microsofts JDBC drivers into Oracle's JVM, and connect through JDBC to SqlServer. This is however not supported by Oracle, but it will work. See:
    * What is required for a Java Stored Procedure to connect to a SQL Server Database? - https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=276167.1
    See also:
    * Options for Connecting to Foreign Data Stores and Non-Oracle Databases - https://metalink.oracle.com/metalink/plsql/showdoc?db=NOT&id=233876.1
    * JDBC Developer's Guide - http://download-west.oracle.com/docs/cd/B14117_01/java.101/b10979/overvw.htm
    Good luck, Erik Ykema

  • Connecting to Windows SQL server from Unix Oracle Server

    How can I connect to Windows MS SQL server from Unix Oracle Server? What installation or package will I need?

    Two options:
    1) Do a search on "Oracle Transparent Gateways" and/or "Heterogenous Services". These are products that are designed solely to connect to other databases from Oracle.
    2) Use a type-4 JDBC driver for SQL Server, installed and running in the JVM of your Oracle server. I'm assuming your Oracle database is sufficiently recent to be java-enabled here.
    Justin

  • Connect to MS-SQL Server from a Oracle 10g running under Solaris

    Hi,
    I have the following problem. I want to access a MS-SQL server from an Oracle database (10g Enterprise licence) that is running on Solaris.
    After googling a while, the following questions arise:
    - Is it correct that the Oracle Transparant Gateway for the SQL Server is not available on Solaris platforms (but only on Windows)?
    - Is it right, that the second possibility to solve this problem is to use an SQL-Server odbc driver for Solaris and access the SQL-Server over ODBC? And: Is this feature included in the Enterprise licence?
    - If yes, which driver is good and cheap ;-)?
    - Is there any other way to solve this problem?
    Thanks
    Aron
    Message was edited by:
    user583720

    I believe the Transparenet Gateway for SQL Server is available on Solaris. The problem is that you need a Unix based ODBC driver which you will also need to pay for.
    We had this same problem and decided to run a windows based Heterogeneous Services gateway and routed through it instead of using the SQL Server transparent gateway. The Heterogenous severives gateway is NOT an add on product (as is Transparent Gateway). The drawback would be performance as I would expect the native MS SQL transparent gateway to perform better, but in our case it worked acceptably.

  • Connect to another SQL server from SAP

    Hi All,
    I want to connect SAP to another SQL server. Basically each day I need to take data from 2 tables in SAP tables to another sql server. I want this to be automated via a program in SAP.
    Please suggest me some methods to achieve this.
    I have searched the web and found that this is possiable, some transactions such as DBCO was mentioned, but it was not much helpful.
    Thanks a lot.
    Regards,
    Pankaj

    Moderator message - Cross post locked
    Rob

  • Connecting to Microsoft SQL Server from Linux

    Hi,
    I am currently trying to migrate an OBIEE deployment from Windows to Linux, I have found much information about connection to Oracle DBs but I cannot find out how to connect to a Microsoft SQL Server DB. I have my webcat and RPD transferred but see ODBC errors for all of the reports, can anyone help?
    Thanks in advance.

    I eventually solved this using UnixODBC and FreeTDS, I have yet to complete my own write-up of the solution but I found that someone else had solved the problem at more-or-less the same time and has written up the solution here:
    http://iadvise.blogspot.com/2008/02/connect-from-rhel5-to-mssqlserver.html
    If anyone finds this in the future and has questions please feel free to get in touch, I get email when this thread is updated so that should be enough. Thanks to Damon for putting me on the right track.

  • Connect to MS SQL SERVER FROM ORACLE 10G(OS- WIN XP)

    HI
    I NEED TO ACCESS MS SQL SERVER DATABASE FROM ORALCE 10G(OS -WIN XP)
    SOLUTION PLZ?
    Edited by: X7C7 on Nov 26, 2008 11:47 AM

    http://download.oracle.com/docs/cd/B19306_01/gateways.102/b14270/ch2.htm#sthref35
    HTH...

  • How to connect to SQL Server from Forms 10g?

    Hello all,
    How do we connect to SQL Server database from Forms 10g?
    In Oracle Metalink site they have suggested using Transparent Gateway for SQL Server as a solution.
    But is there a way we can connect directly to SQL Server from Forms using an ODBC connection
    without installing anything on the database server?
    Pls help!
    Regards,
    Sam

    Hello all,
    I was able to connect to SQL Server from Oracle using Generic Connectivity (HSODBC).
    Transparent gateway was not required.
    Followed metalink note 109730.1
    So, after I created a dblink to SQL Server, I created a synonym for the dblinked SQL Server table.
    When I used the synonym as the table source in Oracle Forms, I got the following error while querying.
    "ORA-02070 - ROWID is not supported in this context."
    This is because Forms has an invisible ROWID field and when data is fetched from SQL Server table
    no Rowid is fetched since SQL Server table doesn't have one.
    Is there a way to overcome this issue or do we have populate the block manually using a SQL query ?
    Pls suggest.
    Regards,
    Sam

  • Connecting to MS SQL Server on UNIX/LINUX

    Hello friends,
    Is there a driver available to connect to MS SQL Server from a java application or servlet running on UNIX or Linux box?
    Is there a way to create ODBC connection to it on UNIX?
    Thank you!

    Is there a driver available to connect to MS SQL Server from a java application or servlet running on UNIX or Linux box? Quite probably. Go here to find out:
    http://industry.java.sun.com/products/jdbc/drivers
    Is there a way to create ODBC connection to it on UNIX?I've heard something about a Unix ODBC simulator, but I wouldn't bother with that. ODBC is not necessary in this situation.

  • Accessing MS Sql Server with Java classes - problem connecting to socket

    I found an example at this location which uses java classes to connected to MS Sql Server.
    http://search400.techtarget.com/tip/1,289483,sid3_gci1065992,00.html
    --bummer - it is a login location - so I will include the article
    Anyway, the example is using Websphere, but I am still on Jbuilder (will get wsad soon). So I planted the classes from the example in
    C:\Borland\JBuilder\jkd1.4\jre\lib\ext\...the classes
    Then I copied the code from the example to my jpx project and got an error that it could not connect to the socket. The only thing I changed in the code was the connection string:
    --original string from example:
    Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://1433", "");
    I was getting an error with the 2 argument version of DriverManager - and the second argument here was empty (properties argument). Here was my connection string:
    Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://Myserver:1433;User=sa;Password=");
    I am only using the 1 argument version of DriverManager. Note that the password=" is blank because my RnD workstation is standalone - no one accesses the sql server except me - so no password. I also left out the last semicolon I noticed. Any suggestions appreciated how I could fix this.
    Thanks
    source of article:
    http://search400.techtarget.com/tip/1,289483,sid3_gci1065992,00.html
    iSeries 400 Tips:
    TIPS & NEWSLETTERS TOPICS SUBMIT A TIP HALL OF FAME
    Search for: in All Tips All search400 Full TargetSearch with Google
    PROGRAMMER
    Sample code: Accessing MS SQL Server database from the iSeries
    Eitan Rosenberg
    09 Mar 2005
    Rating: --- (out of 5)
    Nowadays with the help of Java the iSeries can be integrated with other databases quite easy. This tip shows you how. The code included here uses the free Microsoft driver that can be downloaded from here. (SQL Server 2000 Driver for JDBC Service Pack 3)
    If your SQL server does not include the Northwind Sample Database you can find it here.
    http://www.microsoft.com/downloads/details.aspx?familyid=07287b11-0502-461a-b138-2aa54bfdc03a&displaylang=en
    The download contains the following files:
    msbase.jar
    mssqlserver.jar
    msutil.jar
    Those files needs to be copied to the iSeries directories (/home/r_eitan/ExternalJARs).
    Here's the directory structure (on the iSeries) for this sample:
    /home/r_eitan/ExternalJARs - Microsoft files (msbase.jar,mssqlserver.jar,msutil.jar)
    /home/r_eitan/JdbcTest02 - My code (Main.java,Main.class)
    The Java code
    import java.sql.*;
    import java.io.*;
    class Main {
    * Connect to Microsoft SQL server and download file northWind.products as tab
    * seperated file. (products.txt)
    public static void main(String args[]) {
    try {
    PrintStream outPut = new PrintStream(new BufferedOutputStream(new FileOutputStream("products.txt")));
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    //Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://1433", "");
    Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://Myserver:1433;User=sa;Password=");
    System.out.println("Connection Done");
    connection.setCatalog("northWind");
    String sqlCmdString = "select * from products";
    Statement statement = connection.createStatement();
    ResultSet resultSet = statement.executeQuery(sqlCmdString);
    ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
    int columnCount = resultSetMetaData.getColumnCount();
    // Iterate throught the rows in resultSet and
    // output the columns for each row.
    while (resultSet.next()) {
    for (int index = 1; index <=columnCount; ++index)
    String value;
    switch(resultSetMetaData.getColumnType(index))
    case 2 :
    case 3 :
    value = resultSet.getString(index);
    break;
    default :
    value = """ + resultSet.getString(index) + """;
    break;
    outPut.print(value + (index < columnCount ? "t" : ""));
    outPut.println();
    outPut.close();
    resultSet.close();
    connection.close();
    System.out.println("Done");
    catch (SQLException exception)
    exception.printStackTrace();
    catch (Exception exception)
    exception.printStackTrace();
    --------------------------------------------------------------------------------------------------

    My guess is that the server's host name isn't right. It necessarily (or even usually) the "windows name" of the computer. Try with the numeric IP address instead (type "ipconfig" to see it).
    First aid check list for "connection refused":
    - Check host name in connect string.
    - Check port number in connect string.
    - Try numeric IP address of server host in connect string, in case name server is hosed.
    - Are there any firewalls between client and server blocking the port.
    - Check that the db server is running.
    - Check that the db server is listening to the port. On the server, try: "telnet localhost the-port-number". Or "netstat -an", there should be a listening entry for the port.
    - Try "telnet serverhost the-port-number" from the client, to see if firewalls are blocking it.
    - If "telnet" fails: try it with the numeric ip address.
    - If "telnet" fails: does it fail immediately or after an obvious timeout? How long is the timeout?
    - Does the server respond to "ping serverhost" or "telnet serverhost" or "ssh serverhost"?

  • DAC source connectivity to MS sql server 2008 express

    Hi all,
    I'm working with the latest version of BI Apps (7.9.6.3) and DAC 10.1.3.4.1. I've installed Informatica 9.0.1 on Windows server 2008 R2.
    Now I'm hitting an issue as I am trying to setup a DAC physical connection to source system. We are pulling from a MS SQL Server 2008 physical source. But when I try to test the connection using the DAC (Physical data source), it fails saying +"Failure connecting to "<connection name>"! MSSQL driver not available!"+
    I tried using Microsoft SQL Server JDBC Driver 2.0 (sqljdbc.jar,sqljdbc4.jar) and Microsoft SQL Server JDBC Driver 3.0 (sqljdbc.jar,sqljdbc4.jar) then its giving me below error
    Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
    Has anyone successfully connected to MSSQL server as a source from the DAC? I checked the DAC documentation but it was definitely not helpful in this situation.
    Thanks for the advice.

    Hi,
    Have you placed this jar file in Installation_Home/bifoundation/dac/lib directory and then restart the server and try to test the connection through dac.
    Thanks,
    Navin Kumar Bolla

  • Java Concurrent Program - connecting to MS SQL Server

    Hi,
    I hope this is correct forum to post this question.
    I am writing a JCP which will connect to a MS SQL Server DB, pull data from a table and populate this data into a custome table in EBS (R12.1.1) database. But I am facing some issues.
    When I run run this concurrent program from EBS, I get following exception message:
    Wed Aug 08 01:18:04 GMT 2012: In openConection()
    Wed Aug 08 01:18:04 GMT 2012: Before Loading Driver com.microsoft.jdbc.sqlserver.SQLServerDriver
    Wed Aug 08 01:18:04 GMT 2012: openConection() ClassNotFoundException: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
    Wed Aug 08 01:18:04 GMT 2012: Before Calling processPrintMachineRecords()
    Wed Aug 08 01:18:04 GMT 2012: Exception:: java.lang.NullPointerException
    Wed Aug 08 01:18:04 GMT 2012: In closeSQLServerConnection().......closing JDBC Connection
    Wed Aug 08 01:18:04 GMT 2012: Connection object was null, hence skipping close
    Wed Aug 08 01:18:04 GMT 2012: After Calling processPrintMachineRecords()
    The I read somewhere on internet that I should set CLASSPATH in options field of concurrent program definition. So I provided classpath as follows:
    -cp /rs01/u02/applmgr/utyeb02/apps/apps_st/appl/au/12.0.0/appsborg.zip:/rs01/u02/applmgr/utyeb02/apps/apps_st/comn/java/classes/apps.zip:/rs01/u02/applmgr/utyeb02/apps/apps_st/comn/java/classes/sqljdbc_4.0/enu/sqljdbc.jar
    In this classpath sqljdbc.jar contains the classes for connecting to MS SQL Server DB. However after giving classpath like this I started getting different error:
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/apps/fnd/cp/request/Run
    Caused by: java.lang.ClassNotFoundException: oracle.apps.fnd.cp.request.Run
         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    It appears from the error message that after giving this CLASSPATH, program was not able to find the "Run" method itself. In otherwords, CLASSPATH screwed it further.
    Can anybody please point out what am I doing wrong here?
    Regards
    Java Code:
    package oracle.apps.custom.printmachine;
    import java.sql.*;
    import oracle.apps.fnd.cp.request.* ;
    import java.io.*;
    import oracle.apps.fnd.util.*;
    public class PrintMachineInterface implements JavaConcurrentProgram {
    public static final String M_SUCCESS = "SUCCESS";
    public static final String M_ERROR = "ERROR";
    public static final String M_WARNING = "WARNING";
    int mRequestStatus = -1;
    int max_number_of_records = 99999999;
    private String mSqlServerHost = "mysqlserver.domain.com";
    // Application Short Name
    private String applName;
    CpContext mCtx;
    LogFile logFile;
    OutFile outFile;
    Connection mConn = null;
    ReqCompletion lRC;
    public PrintMachineInterface(){
    // if no parameter value is specified for APPLNAME then use FND
    //as default value
    applName = "FND";
    private void logMessage(String str) {
    java.util.Date now = new java.util.Date();
    logFile.writeln(now.toString() + ": " + str, LogFile.STATEMENT);
    static String mInsertRecord = " Declare " + " BEGIN "
    + " INSERT INTO XXGFN_GBL_CE_PM_STAGE(ID, KEY, FILENAME, PRINTED_AT, CREATED_AT, DOCTYPE, LANGUAGE, OU, TRX_ID, DOC_ID, REQ_ID, TEMPLATE, PAGES, DOC_TEXT, TIMES_RECEIVED)"
    + " VALUES (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, substr(:14,2000), :15);"
    + " COMMIT;"
    + " END;";
    static Connection con = null;
    public void openConection() {
    logMessage( "In openConection()");
    try {
    logMessage( "Before Loading Driver com.microsoft.jdbc.sqlserver.SQLServerDriver");
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    logMessage( "After Loading Driver com.microsoft.jdbc.sqlserver.SQLServerDriver");
    logMessage( "Attempting to connect to " + mSqlServerHost);
    con = DriverManager.getConnection("jdbc:microsoft:sqlserver://" + mSqlServerHost + ":1433;User=sql_user;Password=sql_pwd");
    logMessage( "After con assigned from getConnection(jdbc:microsoft:sqlserver://" + mSqlServerHost + ":1433;User=pm_dba_access;Password=*****");
    } catch (java.lang.ClassNotFoundException e) {
    logMessage("openConection() ClassNotFoundException: " + e);
    } catch (SQLException ex) {
    logMessage("openConection() SQLException: " + ex);
    public void closeSQLServerConnection() {
    try {
    logMessage( "In closeSQLServerConnection().......closing JDBC Connection");
    if (con != null)
    logMessage( "Con is not null");
    con.close();
    logMessage( "Con Closed Successfully");
    else
    logMessage( "Connection object was null, hence skipping close");
    } catch (SQLException ex) {
    logMessage("SQLException: " + ex);
    } catch (Exception ex) {
    logMessage("Exception in closeSQLServerConnection() : " + ex);
    private void populate_staging_table(
    String p_id,
    String p_key,
    String p_filename,
    String p_printed_at,
    String p_created_at,
    String p_doctype,
    String p_language,
    String p_ou,
    String p_trx_id,
    String p_doc_id,
    String p_req_id,
    String p_template,
    String p_pages,
    String p_doc_text,
    String p_times_received
    PreparedStatement lStmt = null;
    logMessage("Populating data from PrintMachine history table");
    try {
    lStmt = mConn.prepareCall(mInsertRecord);
    lStmt.setString(1, p_id);
    lStmt.setString(2, p_key);
    lStmt.setString(3, p_filename);
    lStmt.setString(4, p_printed_at);
    lStmt.setString(5, p_created_at);
    lStmt.setString(6, p_doctype);
    lStmt.setString(7, p_language);
    lStmt.setString(8, p_ou);
    lStmt.setString(9, p_trx_id);
    lStmt.setString(10, p_doc_id);
    lStmt.setString(11, p_req_id);
    lStmt.setString(12, p_template);
    lStmt.setString(13, p_pages);
    lStmt.setString(14, p_doc_text);
    lStmt.setString(15, p_times_received);
    lStmt.execute();
    lStmt.close();
    } catch (SQLException s) {
    logMessage("Exception thrown w/ error message: "
    + s.getMessage());
    s.printStackTrace();
    finally {
    try {
    if (lStmt != null)
    lStmt.close();
    } catch (SQLException e) {
    logMessage("SQLException: " + e);
    private void processPrintMachineRecords() {
    int number_of_recs = 0;
    try {
    PreparedStatement stmt = con.prepareStatement("SELECT TOP 1000 ID, Key, Filename, PrintedAt, CreatedAt, Doctype, Language,OU, TransactionID, DocumentID, RequestID, Template, Pages, Documenttext, TimesReceived FROM PM_DATA.dbo.History" );
    ResultSet rst = stmt.executeQuery();
    while (rst.next()) {
    number_of_recs++;
    if (number_of_recs == max_number_of_records) break;
    populate_staging_table(
    rst.getString(1), rst.getString(2)
    ,rst.getString(3), rst.getString(4)
    ,rst.getString(5), rst.getString(6)
    ,rst.getString(7), rst.getString(8)
    ,rst.getString(9), rst.getString(10)
    ,rst.getString(11), rst.getString(12)
    ,rst.getString(13), rst.getString(14)
    ,rst.getString(15)
    stmt.close();
    rst.close();
    mConn.commit();
    } catch (SQLException ex) {
    logMessage("SQLException: " + ex);
    catch (Exception ex) {
    logMessage("Exception:: " + ex);
    closeSQLServerConnection();
    public void runProgram(CpContext pCpContext) {
    applName = "XXGFN";
    String l_file_path = null;
    mCtx = pCpContext;
    //get handle on request completion object for reporting status
    lRC = pCpContext.getReqCompletion();
    // assign logfile
    logFile = pCpContext.getLogFile();
    // assign outfile
    outFile = pCpContext.getOutFile();
    // get the JDBC connection object
    mConn = pCpContext.getJDBCConnection();
    l_file_path = ((new File(outFile.getFileName())).getParent() == null ? ""
    : (new File(outFile.getFileName())).getParent());
    // get parameter list object from CpContext
    ParameterList lPara = pCpContext.getParameterList();
    while (lPara.hasMoreElements())
    NameValueType aNVT = lPara.nextParameter();
    if ( aNVT.getName().equals("APPLNAME") )
    applName = aNVT.getValue();
    /** openConection() Opens the connection to SQL Server Database*/
    openConection() ;
    logMessage("Before Calling processPrintMachineRecords()");
    processPrintMachineRecords();
    logMessage("After Calling processPrintMachineRecords()");
    try{
    setCompletion(ReqCompletion.NORMAL, "Request Completed Normal");
    } catch (Exception e) {
    setCompletion(ReqCompletion.ERROR, e.toString());
    } finally {
    pCpContext.releaseJDBCConnection();
    * Sets the request completion status based on proper precedence. ERROR >
    * WARNING > NORMAL
    * @param pStatus
    * Status of the request.
    * @param pCompletionText
    * Request's completion text.
    public void setCompletion(int pStatus, String pCompletionText) {
    if ((pStatus == ReqCompletion.ERROR)
    || ((pStatus == ReqCompletion.WARNING) && (mRequestStatus != ReqCompletion.ERROR))
    || ((pStatus == ReqCompletion.NORMAL)
    && (mRequestStatus != ReqCompletion.WARNING) && (mRequestStatus != ReqCompletion.ERROR))) {
    mRequestStatus = pStatus;
    lRC.setCompletion(pStatus, pCompletionText);
    }

    ok
    i used Template.java as input
    useful MOS:
    How To Create a Java Concurrent Program? [ID 827563.1]
    Java Concurrent Program FAQ [ID 827575.1]
    i used
    //goto ms sql server 2008r2       
            try{
             Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");        
             con = java.sql.DriverManager.getConnection( 
                                          "jdbc:sqlserver://1.2.3.4:1433;databaseName=test;selectMethod=cursor", 
                                          "test", "test");          
              if(con!=null) System.out.println("Connection Successful!");
            }catch(Exception e){
              e.printStackTrace();
              System.out.println("Error Trace in getConnection() : " + e.getMessage());
            }1.2.3.4 - ip of instance with sqlserver2008r2 :)
    in your code
    >
    try {
    logMessage( "Before Loading Driver com.microsoft.jdbc.sqlserver.SQLServerDriver");
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    logMessage( "After Loading Driver com.microsoft.jdbc.sqlserver.SQLServerDriver");
    logMessage( "Attempting to connect to " + mSqlServerHost);
    con = DriverManager.getConnection("jdbc:microsoft:sqlserver://" + mSqlServerHost + ":1433;User=sql_user;Password=sql_pwd");
    logMessage( "After con assigned from getConnection(jdbc:microsoft:sqlserver://" + mSqlServerHost + ":1433;User=pm_dba_access;Password=*****");
    } catch (java.lang.ClassNotFoundException e) {
    logMessage("openConection() ClassNotFoundException: " + e);
    } catch (SQLException ex) {
    logMessage("openConection() SQLException: " + ex);
    >
    try my case for Driver and Connection
    put result .class file to needed directory
    put sqljdbc4.jar to /rs01/u02/applmgr/utyeb02/apps/apps_st/comn/java/lib
    and for concurrent program option
    -classpath /rs01/u02/applmgr/utyeb02/apps/apps_st/comn/java/classes:/rs01/u02/applmgr/utyeb02/apps/apps_st/appl/au/12.0.0/appsborg.zip:/rs01/u02/applmgr/utyeb02/apps/apps_st/comn/java/lib/sqljdbc4.jaralso useful mos:
    Classpath Setting of Third Party Jar Files in R12 Java Concurrent Program (JCP) [ID 1292694.1]

  • Connect to SQL Server from Oracle

    Does Oracle offer any connectivity to NON-Oracle databases such as SQL Server from within the Oracle database itself, similar to a database link ?

    Yes, it's called Heterogeneous Connectivity. Basically how it works is you set up an ODBC data source on the Oracle server
    and need to modify the tnsnames.ora and listener.ora files. Once you get it set up it works exactly like a dblink. You should be
    able to find information on it in the Oracle manuals or from Metalink. There's also a Heterogenous Connectivity forum on OTN. If
    you can't find anything let me know and I can send you some documents on how to set it up. I think the hardest part for you might
    be finding a SQL Server ODBC driver for HP-UX.

Maybe you are looking for