How i connect to SQL server using java?

hi every body
i need to connect to a sql server database using java
i do not know sql driver in java
plz help me
thanks

This is certainly the wrong forum for that question. Search in the JDBC forum. This has been asked and answered many times.

Similar Messages

  • How do i connect to sql server using java?

    hi ever body
    i need to connect to sql server using java
    what is the driver i will use?
    thanks

    Microsoft make a jdbc driver and it is readily available through MSDN. Here is a link http://msdn2.microsoft.com/en-us/data/aa937724.aspx. Whatever jdbc driver you are looking for, Google it, and if it exists you'll find it in 10 seconds.

  • How to connect MS sql server using ODI

    Hi ,
    i am trying to connect MS SQL server database with ODI .
    I have copied sqljdbc.jar file in drivers folders .i got this driver from MSDN
    While creating data source i have selected com.microsoft.jdbc.sqlserver.SQLServerDriver driver
    i am giving connection string as jdbc:microsoft:sqlserver://hostname:1438;databaseName=siebeldb;user=SIEBEL;password=SI
    ODI java version :1.5.0_20
    i am getting following error :
    com.sunopsis.sql.c: com.microsoft.jdbc.sqlserver.SQLServerDriver
         at com.sunopsis.sql.SnpsConnection.a(SnpsConnection.java)
         at com.sunopsis.sql.SnpsConnection.testConnection(SnpsConnection.java)
         at com.sunopsis.sql.SnpsConnection.testConnection(SnpsConnection.java)
         at com.sunopsis.graphical.r.or.o(or.java)
         at com.sunopsis.graphical.r.or.r(or.java)
         at com.sunopsis.graphical.r.or.g(or.java)
         at com.sunopsis.graphical.r.or.a(or.java)
         at com.sunopsis.graphical.r.or.a(or.java)
         at com.sunopsis.graphical.r.il.actionPerformed(il.java)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.Dialog$1.run(Unknown Source)
         at java.awt.Dialog$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.awt.Dialog.show(Unknown Source)
         at java.awt.Component.show(Unknown Source)
         at java.awt.Component.setVisible(Unknown Source)
         at com.sunopsis.graphical.r.or.q(or.java)
         at com.sunopsis.graphical.r.or.<init>(or.java)
         at com.sunopsis.graphical.frame.a.ji.bx(ji.java)
         at com.sunopsis.graphical.frame.bn.w(bn.java)
         at com.sunopsis.graphical.frame.bn.d(bn.java)
         at com.sunopsis.graphical.frame.w.actionPerformed(w.java)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    any pointers on this will be very usefull.
    regards ,
    MOhan

    HI ,
    i have copied 1.2 driver in my drivers dir and pointed oDI java home to 1.4.2 JRE .
    tried testing connection with above Driver and connection string
    now i got below error
    java.sql.SQLException: No suitable driver
         at java.sql.DriverManager.getDriver(Unknown Source)
         at com.sunopsis.sql.SnpsConnection.u(SnpsConnection.java)
         at com.sunopsis.sql.SnpsConnection.a(SnpsConnection.java)
         at com.sunopsis.sql.SnpsConnection.testConnection(SnpsConnection.java)
         at com.sunopsis.sql.SnpsConnection.testConnection(SnpsConnection.java)
         at com.sunopsis.graphical.r.or.o(or.java)
         at com.sunopsis.graphical.r.or.r(or.java)
         at com.sunopsis.graphical.r.or.g(or.java)
         at com.sunopsis.graphical.r.or.a(or.java)
         at com.sunopsis.graphical.r.or.a(or.java)
         at com.sunopsis.graphical.r.il.actionPerformed(il.java)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.Dialog$1.run(Unknown Source)
         at java.awt.Dialog.show(Unknown Source)
         at java.awt.Component.show(Unknown Source)
         at java.awt.Component.setVisible(Unknown Source)
         at com.sunopsis.graphical.r.or.q(or.java)
         at com.sunopsis.graphical.r.or.<init>(or.java)
         at com.sunopsis.graphical.frame.a.ji.bx(ji.java)
         at com.sunopsis.graphical.frame.bn.w(bn.java)
         at com.sunopsis.graphical.frame.bn.d(bn.java)
         at com.sunopsis.graphical.frame.w.actionPerformed(w.java)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

  • How to access sql server using java script

    Hi, Is it possible to connect to sql server in java script. I'm using microsoft jdbc driver for connectivity to sql server.
    Thanks

    Hi, Is it possible to connect to sql server in java
    script. I'm using microsoft jdbc driver for
    connectivity to sql server.If you want to ask about Javascript, you are in the wrong place. Go and find some JavaScript forum. Actually, you could connect to database from javascript using Ajax or the like mainly because you could have Java code behind the scenes, but then that too is not something I would want to discuss here. So, go find the correct place for the topic.

  • How to connect MS-sql server with SAP BW

    hi all,
    i want the connection procedure to how to connect MS-sql server with SAP BW.so that i can extract the data from ms sql server and can create cubes using that data.please help me in this issue.

    Hi Vamshi,
    Go through this DOC it explains u how to connect to other data bases like SQL...
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/58f4db47-0501-0010-a2bf-ff01b150fdff]
    this is a thread related to connect the SQL server..
    [DB Connect MS SQL Server;
    Regards,
    NR
    Assign points if helpful...

  • MARS connection to SQL Server in JAVA via ODBC

    Hello.
    I've got this problem.
    I'm managing an application JAVA/JSP, based on a 3-tier architecture.
    The connection to the database is performed via JDBC/ODBC, in order to work with different DRMS.
    Everything is ok when connecting to Oracle or MySql via JDBC, but when we connect to SQL Server via ODBC we get this error: "ODBC SQL SERVER - Connection is busy with result for another stmt".
    That's why the application executes more than one SQL statement, opening a ResultSet object, under the same connection.
    This is the way the application is performing, and we can't change it.
    I've read that on SQL Server 2005 is available a new connection parameter called MARS (Multiple Active Result Sets), that should resolve this problem.
    But I was not able to find any way to invoke this type of connection in JAVA for an ODBC connection! (I've found only tips for .NET...).
    Many thanks if somebody can suggest me how to resolve this problem.
    It's urgent!

    Use JDBC. Get a SQL server JDBC driver. Unfortunately I don't know of any free ones, but one I have used in the past is from http://www.jnetdirect.com/
    Maybe you can search in the JDBC forum for the answer - Its a common enough question I know.

  • 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

  • How to connect MS SQL Server 2000 with JDeveloper 11g

    Hi,
    I am new to JDevleoper, Is it possible to connect MS SQL Server 2000 with JDeveloper 11g.
    If possible can anyone help me in doing that?
    waiting for ur reply...
    Thanks in advance
    Regards,
    reddy

    Shay or other knowledgeable folks,
    Is there a way to utilize the wizard for "Business Tier > ADF Business Components > Business Components from Tables" for SQL Server 2000, 2005 or 2008. I can successfully execute sql via java programmatically or import a table from SQL Server with "Business Tier > ADF Business Components > Entity Object" wizard, but the Business Components from Tables simply doesn't see any tables under any schema. Without the "Business Components from Tables", i don't get the referential constraints imported into the application and to code all those from scratch is just not as elegant. So far i have only utilized the sql server jdbc driver from Microsoft (versions, 1.1, 1.2 and 2.0). Is there an alternative client that i need to use to enable selecting tables from that "Business Components from Tables" wizard. Is this a limitation of SQL Server, the jdbc driver or the wizard itself? Did anybody else experience the same issues? I am using Jdeveloper 11.1.1.0.1 against SQL Server 2005 (currently)
    Thanks,
    Andy

  • Connection with SQL Server using DBCO

    Hi,
    I want to connect to Misrosoft SQL Server using DBCO transaction. I have given the following fields.
    DB Connection = test
    DBMS = MSS
    User Name = user02
    password = test
    Conn. info = MSSQL_SERVER=tcp:10.100.50.36 MSSQL_DBNAME=New_Wisdom
    permanent selected
    Connection Limit = 5
    Optimum Conns = 2
    while executing through the statement as follows,
    EXEC SQL.
    CONNECT :'TEST'
    ENDEXEC.
    I am getting the dump ' An SQL error occurred when executing Native SQL.
    The error 900 occurred in the current database connection "DEFAULT".' Please suggest me what needs to be added or corrected.

    Hi Benito.
    I'm not very familiar with MSS but maybe the following will help a little bit.
    Depending on the version of your SAP system you can use the transaction DBACOCKPIT to add connections to non-SAP databases. There is an test connection button in that transaction, too. You will find some information about that transaction in some whitepapers here in the SDN. For example have a look at this one: https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1062428c-f1df-2910-b08f-c322feddcd10
    ADBC error 16 is just "something went wrong". Is your SAP system using MSS, too? If not you will need the matching DBSL for it on your SAP system.
    If you have set up an connection you can use program ADBC_TEST_CONNECTION to check if everything is ok. If I remember it correctly in case of errors it allows you to jump into the trace file. There you should find some usefull information.
    Perhaps asking in the Database&OS forum area (there is a MSS forum) might help, too.
    Best regards,
    Jan

  • How to connect MS-SQL Server??

    hi
    Currently BI server is install in Linux and connected to our Oracle Server which also in Linux now I need to connect MS-SQL Server which is windows base to get some data.
    What is the procedure to do this?
    Please mention in steps?

    Hi Ishkan,
    I hope the below theads will shed some light to your requirement .
    /people/gilad.weinbach2/blog/2007/03/20/leveraging-your-sap-bi-data-using-the-microsoft-bi-platform
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2f0fea94-0501-0010-829c-d6b5c2ae5e40?quicklink=index&overridelayout=true
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/58f4db47-0501-0010-a2bf-ff01b150fdff
    Regards,
    Nibu Antony

  • How to connect to SQL Server (Non-SAP) in SAP R/3(Unix)?

    Hi, All..
    please, help me.
    I am ABAPer.
    I already read the text for connect DB.
    but, I am not clear.
    my system is,
    - Source : SAP R/3, Oracle DB, Unix(OS)
    - Target : Non-sap, SQL Server, Windows 2000
    I want to connect to SQL Server by EXEC SQL.
    Waht's BC(Basis) Jobs?
    Thanks, all.

    Hello,
    have a look at Note: 323151.
    Regards
    Gregor

  • How to Connect MS Sql Server to EP

    Hello SAP  Gurus,
    I want to connect Ms Sql Server to my Enterpirse portal.so please give me full details as well document related to that one.i want to see the report which are in MS Sql Sever in our portal so what kind of setting required.
    please give me the solution.
    Regards
    Neeraj Pandey

    Neeraj,
    Please check the following links which are related to your requirement.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f29700e2-0701-0010-cc82-f0c3a3e308ca
    connection between SAP EP and MS SQL 2000
    Error in Configuring EP to MS SQL 2000
    Reward points if handy!
    Regards,
    Sandeep Tudumu

  • How do i connect to SQL server using the JDBC ODBC

    I am attempting to connect to a database on a server over a network. It is running SQL Server 2005. Am i supposed to set the ODBC on my computer or on the server computer and this is the code i am using but i keep getting a class not found exception.
    //Variables for the connection to the second Database static final String JDBC_DRIVER2 = "com.microsoft.sqlserver.jdbc";; static final String DATABASE_URL2 = "jdbc:sqlserver:///*serverName*/;databaseName=Dashboard;" + "user=dashboard; password = **********"; private Connection connection2; public void Connection2() throws Exception{ Class.forName(JDBC_DRIVER2); connection2 = DriverManager.getConnection(DATABASE_URL2); System.out.println("Connected 2"); Statement statement2 = connection2.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); }
    I have the server's actual name in /*serverName*/ so i know that it is not the issue i left it out for business sensitivity.
    I downloaded sqljdbc.jar and have placed it both in my eclipse driver folder and in the project folder itself.
    Any help would be very grateful.
    Thanks Nathan M.

    ODBC has nothing to do with the driver in the code that you posted.
    Class not found has nothing to do with the connection string.
    And the exception stack trace, if you were printing it, would make that obvious because then you would note that
    it isn't getting to that line.
    Class not found exception means that either your class path is wrong, which is a basic part of java not jdbc,
    or that you specified the class name wrong.
    I downloaded sqljdbc.jar and have placed it both in my eclipse driver folder and in the project folder itself.Apparently that isn't sufficient because it still isn't in your class path.

  • How to connect to SQL server 2000 with Oracle Form

    Hi,
    I'm looking for the document of how to connect "SQL Server 2000" with Oracle Form 6i. Anyone knows that?

    Shay or other knowledgeable folks,
    Is there a way to utilize the wizard for "Business Tier > ADF Business Components > Business Components from Tables" for SQL Server 2000, 2005 or 2008. I can successfully execute sql via java programmatically or import a table from SQL Server with "Business Tier > ADF Business Components > Entity Object" wizard, but the Business Components from Tables simply doesn't see any tables under any schema. Without the "Business Components from Tables", i don't get the referential constraints imported into the application and to code all those from scratch is just not as elegant. So far i have only utilized the sql server jdbc driver from Microsoft (versions, 1.1, 1.2 and 2.0). Is there an alternative client that i need to use to enable selecting tables from that "Business Components from Tables" wizard. Is this a limitation of SQL Server, the jdbc driver or the wizard itself? Did anybody else experience the same issues? I am using Jdeveloper 11.1.1.0.1 against SQL Server 2005 (currently)
    Thanks,
    Andy

  • How to connect MS SQL Server  from SAP based on AIX/ORACLE ?

    Hi ,
    I need  ABAP program to read and write data on MS SQL server.
    The SAP System is based on AIX system and Oracle DB.
    The MS SQL is based on Windows Server System.
    How to do this? 
    Thanks.

    Hello,
    First is crerate a connexion with the target MS SQL. Use the trasaction DBCO.
    Next, You must use EXEC SQL instruction. I give to you an example for read that I use :
    For writting, is the same think. The request SQL must change in update or insert
    Thierry
    DATA dbtype TYPE dbcon_dbms. "dbtype chaine de caractere
    DATA wl_con_name TYPE dbcon-con_name.
    DATA wl_info_con(3).
      DATA wa_sytabix TYPE sy-tabix.
    DATA matnr_temp TYPE mara-matnr.
      DATA refart TYPE mara-matnr.
      DATA consi  TYPE zed_cons.
        wl_con_name = 'CONN_SQL_DATAB'.
      SELECT SINGLE dbms FROM dbcon INTO dbtype WHERE con_name = wl_con_name.
      IF dbtype = 'MSS'.
        TRY.
    *Connexion a la base de donnée
            EXEC SQL.
              CONNECT TO :wl_con_name
            ENDEXEC.
            IF sy-subrc <> 0.
              RAISE EXCEPTION TYPE cx_sy_native_sql_error.
            ELSE.
              MESSAGE s258(zm) WITH wl_info_con.
            ENDIF.
    *Recupération des données
            EXEC SQL.
              OPEN WRECORDSET FOR SELECT Refart, consi FROM Articles
            ENDEXEC.
            IF sy-subrc <> 0.
              RAISE EXCEPTION TYPE cx_sy_native_sql_error.
            ENDIF.
            DO.
              EXEC SQL.
                FETCH NEXT WRECORDSET INTO :Refart, :Consi
              ENDEXEC.
              IF sy-subrc <> 0.
                EXIT.
              ENDIF.
              CLEAR wa_comp.
              CLEAR wa_sytabix.
              READ TABLE wt_comp INTO wa_comp WITH KEY matnr = refart.
              IF sy-subrc = 0.
                wa_sytabix = sy-tabix.
                IF consi = 'F'.
                  wa_comp-consi = 'Non'.
                ELSE.
                  IF consi = 'T'.
                    wa_comp-consi = 'Oui'.
                  ELSE.
                    wa_comp-consi = ''.
                  ENDIF.
                ENDIF.
                MODIFY  wt_comp INDEX wa_sytabix FROM wa_comp.
              ELSE.
              ENDIF.
            ENDDO.
    *on ferme tout
            EXEC SQL.
              CLOSE WRECORDSET
            ENDEXEC.
            EXEC SQL.
              DISCONNECT :wl_con_name
            ENDEXEC.
          CATCH cx_sy_native_sql_error.
            MESSAGE `Error in Native SQL.` TYPE 'I'.
        ENDTRY.
      ENDIF.

Maybe you are looking for