Connect sql server

hi @all
what i want to do
create view (as an object in my oracle database) as select * from ms_sql_server_database_table
that's what i've done till now
load the ms sql jdbc driver 2005 into my oracle-database
i found the following code
can someone help me to get a result from a table based in a ms sql server database and put the resultset in a view of my oracle schema
import java.*;
public class Connect{
private java.sql.Connection con = null;
private final String url = "jdbc:mysqlserver://";
private final String serverName= "localhost";
private final String portNumber = "1433";
private final String databaseName= "pubs";
private final String userName = "user";
private final String password = "password";
// Informs the driver to use server a side-cursor,
// which permits more than one active statement
// on a connection.
private final String selectMethod = "cursor";
// Constructor
public Connect(){}
private String getConnectionUrl(){
return url+serverName+":"+portNumber+";databaseName="+databaseName+";selectMethod="+selectMethod+";";
private java.sql.Connection getConnection(){
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = java.sql.DriverManager.getConnection(getConnectionUrl(),userName,password);
if(con!=null) System.out.println("Connection Successful!");
}catch(Exception e){
e.printStackTrace();
System.out.println("Error Trace in getConnection() : " + e.getMessage());
return con;
private void closeConnection(){
try{
if(con!=null)
con.close();
con=null;
}catch(Exception e){
e.printStackTrace();
thanks

my first steps
create or replace and compile java source named SqlServerConnect as
public class sqlserverconnect{
public void someMethod()
Connection jdbcConnection = null;
try
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String url="jdbc:sqlserver://LFF-YBES132401:1433;databaseName=Northwind";
Connection con = java.sql.DriverManager.getConnection(url,jack,jack);
con.connect();
Statement stmt = con.createStatement();
ResultSet results = statement.executeQuery(
"SELECT id, name FROM employees"
while ( results.next() )
System.out.println( "Employee name is "+results.getString( 2 ) );
results.close();
catch ( Exception e )
// .. TODO: handle exception gracefully
finally
try
con.close();
catch ( SQLException sqle )
but the java source is invalid
errors
SQLSERVERCONNECT:9: cannot resolve symbol
symbol : class Connection
location: class sqlserverconnect
Connection jdbcConnection = null;
^
SQLSERVERCONNECT:21: cannot resolve symbol
symbol : class Connection
location: class sqlserverconnect
Connection con = java.sql.DriverManager.getConnection(url,jack,jack);
^
SQLSERVERCONNECT:21: cannot resolve symbol
symbol : variable jack
location: class sqlserverconnect
Connection con = java.sql.DriverManager.getConnection(url,jack,jack);
^
SQLSERVERCONNECT:21: cannot resolve symbol
symbol : variable jack
location: class sqlserverconnect
Connection con = java.sql.DriverManager.getConnection(url,jack,jack);
^
SQLSERVERCONNECT:27: cannot resolve symbol
symbol : class Statement
location: class sqlserverconnect
Statement stmt = con.createStatement();
^
SQLSERVERCONNECT:29: cannot resolve symbol
symbol : class ResultSet
location: class sqlserverconnect
ResultSet results = statement.executeQuery(
^
SQLSERVERCONNECT:29: cannot resolve symbol
symbol : variable statement
location: class sqlserverconnect
ResultSet results = statement.executeQuery(
^
SQLSERVERCONNECT:67: cannot resolve symbol
symbol : variable con
location: class sqlserverconnect
con.close();
^
SQLSERVERCONNECT:71: cannot resolve symbol
symbol : class SQLException
location: class sqlserverconnect
catch ( SQLException sqle )
^
9 errors
i'm not able to solve the problem

Similar Messages

  • Unable to connect SQL server 2005 databse with JSF applications !

    Hello guys!
    Help me out to connect SQL server 2005 Databse with JSF applications using JDBC-ODBC bridge. I'm working with Netbeans 6.1 IDE.
    I tried for the basic applications but instead got this error:
    "unable to deploy jdbc drivers to the <project>domain/lib"
    Please help me out with working sample codes that connects MS SQL server 2005 DB with JSF!!
    Thank you guys!

    1) don't use the bridge driver
    2) don't do database access from JSF
    3) learn how to use your application server
    4) learn how to use your IDE

  • How to connect SQL server

    Hi
    I want to know how to connect SQL server using DNSless connection ?
    /* 2003/02/06 eric.leung
    * Source : HOME
    import java.sql.*;
    import java.lang.*;
    public class ejdbcsel {
         public static void main(String args[]) {
              // eric_jsp is ODBC User DNS
              // String url = "jdbc:odbc:eric_jsp";     
              // Using DSNless connection
              String url = "";
              url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)}" +
              ";SERVER=127.0.0.1;DBQ=c:\\example\\ERIC_JSP.mdb";
              Connection con;
              String query;
              query = "select * from pt_mstr";     
              Statement stmt;
         try {     
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         } catch (ClassNotFoundException e) {
              System.err.print("ClassNotFoundException " );
              System.err.println(e.getMessage());
         try {
              con = DriverManager.getConnection (url,"","");
              stmt = con.createStatement();
              ResultSet rec = stmt.executeQuery(query);          
              // Scan the Database
              while(rec.next()) {
                   System.out.println(rec.getString("pt_part") + "\t"
                   + rec.getString("pt_desc"));     
              stmt.close();
              con.close();
         } catch (SQLException ex) {
              System.err.println("SQLException: " + ex.getMessage());
         catch (Exception e) {
              System.err.println("Error: " + e.toString() + " " + e.getMessage());

    Use a driver...
    http://java.sun.com/products/jdbc/driverdesc.html
    http://industry.java.sun.com/products/jdbc/drivers

  • How to Connect SQL Server enterprises Manager Version 8.0 with Form 6i

    Dear experts
    I want to know that How can I connect SQL server Enterprise Manager Version 8.0 with Forms/reprots 6i.
    currently I have oracle 9i database at server windows 2003 and I also connected with client (my PC) I work on server.
    I also have SQL server in that server 2003 machine and this SQL Server also work with other clients that have VB program.
    I want to know that can I connect with this SQL server with Form 6i?

    You can't. The closest thing would be to create links in an oracle database to the SQL Server database using Heteregeneous Services and connect forms to the that.
    This forum is for the SQLDeveloper tool. You will get more complete answers in the "Database General", or "Heterogeneous Services" forums

  • How to connect sql server at RunTime?

    Hi,I have a question that when i want to use DBAdapter to connect sql server 2000 in oracle esb at RunTime.
    At design Time ,it can work.but at RunTime ,it does't work.
    At run time,
    1)modify Oracle_Home/j2ee/home/config/application.xml
    add follow elements,the path is right:
    <library path="../applib/msbase.jar"/>
    <library path="../applib/mssqlserver.jar"/>
    <library path="../applib/msutil.jar"/>
    2)Drop the JAR files into the following directories:
    Oracle_Home/j2ee/home/applib
    JAR files Include msbase.jar,mssqlserver.jar,msutil.jar
    But it does't work!!!
    Then i use DataDirect driver:
    YMbase.jar,YMutil.jar,YMsqlserver.jar
    it does't work either!!!
    what should i do ??
    Help.
    when i use DataDirect driver ,Exception like this:
    An unhandled exception has been thrown in the ESB system. The exception reported
    is: "org.collaxa.thirdparty.apache.wsif.WSIFException:
    esb:///ESB_Projects/PocApp_POCproject/MESInsert.wsdl [
    MESInsert_ptt::insert(MtlMesCollection) ] - WSIF JCA Execute of operation
    'insert' failed due to: Could not create/access the TopLink Session. This
    session is used to connect to the datastore. ; nested exception is: ORABPEL-
    11622 Could not create/access the TopLink Session. This session is used to
    connect to the datastore. See root exception for the specific exception. You may
    need to configure the connection settings in the deployment descriptor (i.e.
    $J2EE_HOME/application-deployments/default/DbAdapter/oc4j-ra.xml) and restart
    the server. Caused by Exception [TOPLINK-4003] (Oracle TopLink - 10g Release 3
    (10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.DatabaseException
    Exception Description: Configuration error. Class
    [com.oracle.ias.jdbc.sqlserver.SQLServerDriver] not found.. at
    oracle.tip.adapter.fw.wsif.jca.WSIFOperation_JCA.executeRequestResponseOperation
    (WSIFOperation_JCA.java:623) at
    oracle.tip.adapter.fw.wsif.jca.WSIFOperation_JCA.executeInputOnlyOperation(WSIFO
    peration_JCA.java:726) at
    oracle.tip.esb.server.common.wsif.WSIFInvoker.executeOperation(Unknown Source)
    at oracle.tip.esb.server.common.wsif.WSIFInvoker.nextService(Unknown Source) at
    oracle.tip.esb.server.common.wsif.WSIFInvoker.nextService(Unknown Source) at
    oracle.tip.esb.server.service.impl.outadapter.OutboundAdapterService.nextService
    (Unknown Source) at
    oracle.tip.esb.server.service.impl.outadapter.OutboundAdapterService.processBusi
    nessEvent(Unknown Source) at
    oracle.tip.esb.server.dispatch.InitialEventDispatcher.dispatchNonRoutingService(
    Unknown Source) at
    oracle.tip.esb.server.dispatch.InitialEventDispatcher.dispatch(Unknown Source)
    at oracle.tip.esb.server.dispatch.BusinessEvent.raise(Unknown Source) at
    oracle.tip.esb.utils.EventUtils.raiseBusinessEvent(Unknown Source) at oracle.
    when i use SQL SERVER JDBC DRIVER,Exception just like before,the different only is
    Class [com.microsoft.jdbc.sqlserver.SQLServerDriver] not found ....

    Hi,
    Were you able to configure these 3 jars file. If so can you share the process that we need to follow to configure the environment so that i can access SQLServer.
    Thanks,
    Amby.

  • How to connect sql server using oracle Client

    Hi,
    I am working in oracle9i and windows os 32 bit.
    I need to connect SQL server 2000 from my oracle client..
    I heard about heterogeneous connectivity ...
    Please expalin me the steps what to add and how to connect the sql server...
    Regs....

    Are you trying to connect to SQL Server from your Oracle database (i.e. create a database link in Oracle to SQL Server)? Or are you trying to connect to SQL Server using your Oracle client software (i.e. SQL*Plus)?
    The former just requires Heterogeneous Services with Generic Connectivity. The latter is functionality that has been depricated and probably no longer works in your environment.
    Justin

  • Connect SQL Server 2012 from Windows Server 2003 with native client 9.0

    Hi,
    I currently have a setup where ETL tool Ab Intio, running on a Linux server, connects to the SQL Server 2005 through a passthrough Wintel server with Windows Server 2003 OS using SQL server native client 9.0
    Now I have the requirement to upgrade the SQL server from 2005 to 2012.
    My question is, will it be possible to connect to SQL server 2012 through Windows Server 2003 with native client 9.0?
    As per the specs, I need native client 11.0+ to fully support SQL Server 2012, but then, as per specs, native client 11.0 doesnot run on Windows server 2003. OS upgradation is currently not on the cards.
    So will it be possible to the run the basic queries we use currently, if we can connect SQL server 2012 through Windows Server 2003 with native client 9.0/10.0, without updgrading the OS of the Wintel server?
    Thanking you in advance! 

    Hi Soumya,
    Yes, you can use the SQL Server Native Client shipped with SQL Server 2005 to connect to a SQL Server 2012 instance, and there is no need to upgrade the operating system.
    Regards,
    Mike Yin
    TechNet Community Support

  • How to connect sql server 2008 r2 sp2 with vs2013 ultimate?

    how to connect sql server 2008 r2 sp2 with visual studio 2013 ultimate?

    Hi Shahzad,
    >>how to connect sql server 2008 r2 sp2 with visual studio 2013 ultimate?
    Based on your issue, if you wan to connect the sql server 2008 r2 sp2 from VS2013 IDE. I suggest you can try the Ammar and darnold924's suggestion to check your issue.
    In addition, I suggest you can also refer the following steps to connect the sql server 2008 r2 sp2 with visual studio 2013 ultimate.
    Step1: I suggest you can go to VIEW->SQL Server Object Explorer->Right click SQL Server->Add SQL Server.
    Step2: After you connect the SQL Server 2008 r2 sp2 fine, I suggest you can go to VIEW->Server Explorer-> right click the Data Connection->Add Connection.
    And then you can create the connect string in the Add Connection dialog box.
    Hope it help you!
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Connecting SQL Server 2008 + CF8 mac

    Hello,
    I am currently porting all of our access databases to SQL Server 2008 and i am using a mac for development. If anyone can tel me how to connect sql server database from the cfadmin on mac to a virtual environment on parallels 5. In the cfadmin on mac SQL Server is listed as a kown datasource you can connect to but the only way i see to do this is thru a virtual environment or remote.
    Please help
    Thanks,
    D

    Having not used Parallels in some time I couldn't say for sure, but essentially that SQL engine needs to be accessible from Coldfusion on an IP address somewhere. Depending on what networking mode you're using, that'll either be:
    1 - Its own IP
    2 - Localhost, or 127.0.0.1
    As long as your ColdFusion instance has network access to the SQL box, there's no additional config required.
    O.

  • How to connect Sql Server 2000 using JDBC ODBC Driver

    How to connect Sql Server 2000 using JDBC ODBC Driver ?
    plz Send Syntax.
    thanks

    In SQL Server 2000 the driver class is com.microsoft.jdbc.sqlserver.SQLServerDriver
    The connection URL for the default SQL Server 2000 database is jdbc:sqlserver://localhost:1433
    Class.forName(
      "com.microsoft.sqlserver.jdbc.
      SQLServerDriver");
    String url =
      "jdbc:sqlserver://localhost:1433";
    Connection conn = DriverManager.
      getConnection(
      url, "sa", "sqlserver");

  • Connecting SQL server using JavaScript

    I found an article on connecting SQL server using JavaScript. http://www.devarticles.com/c/a/JavaScript/Combining-North-Pole-with-South-Pole-JavaScript-with-SQL-Server-2000/
    Do you people think it's possible? i try out the code already but something wrong with it. I just copy and paste it to a html file but it comes out with error. Do I miss out something? Thanks.
    SY Tee

    Check the permissions and server authentication from the below link,
    http://technet.microsoft.com/en-us/library/ms179354(v=sql.90).aspx
    Regards, RSingh

  • Problem when connecting sql server 2005 using SQL developer

    Hi,
    I installed Sql developer and I am trying to connect sql server 2005 using windows authentication. I had previously the SSO folder problem saying the path is missing in java.library.path. I copied the SSO folder into Sqldeveloper directory. I changed the settings under computer management->services and applications->sql server configuration manager->sql server 2005 network configuration ->protocols for sqlexpress->I enabled TCP/IP.
    Now I am getting an error saying "Failure-can not open user default database.Login Failed. Login failed for user ...".
    I am able to connect thru ODBC driver using windows authentication.
    Any help on this is highly appreciated.
    Thanks in advance,
    Lakshmi

    Hi Martin,
    Your solution has solved my problem too. Thanks for posting these workaround fixes :-)
    However, there seem to be a problem with datetime fields. The query:
    select getdate()
    returns something like: oracle.datetimestamp.@1aed4
    Is there a way to get around with this? Otherwise, using SQL Developer as a client for SQL Server doesn't serve the right purpose when we cannot access simple date fields :-)

  • Connecting SQL server from Adobe forms

    Hi Experts,
    I want to know, whether it is possible to connect SQL Server database from Adobe Form directly at runtime without WAS/ADS. If it is possible, please provide any material to proceed further.
    Please help.
    Thanks,
    Rajee

    Have a look at the following document, it explains how to use a MS Access database but it should also work when using a ODBC Data source configured for a MS SQL database.
    [Providing interactive database lookup from forms|http://www.adobe.com/devnet/livecycle/articles/lc_designer_db_lookup_tip.pdf]
    I hope I could help you.

  • UD Connect SQL Server datasource preview error

    Hi Gurus,
    I have sucessfully configured a UD Connection from my BI70 (SP18) unix server to retrieve data from an external Windows based SQL Server database.
    When creating the DataSource, I can see all SQL Server source fields at Proposal tab as below:
    Export_id
    ProjectId
    ProjectName
    ProjectName_ItemID
    ProjShortDesc
    ProjShortDesc_ItemID
    GBU
    GBU_ItemID
    Franchise
    Franchise_ItemID
    Brand
    Brand_ItemID
    ProdSegCategory
    ProdSegCategory_ItemID
    NumbSKU
    Region-Lead
    Region-Lead_ItemID
    ProjectStatus
    ProjectStatus_ItemID
    GBUProjStage
    GBUProjStage_ItemID
    InScopeCountries
    InScopeCountries_ItemID
    ship-to-tradeDate_D*
    ship-to-tradeDate_T*
    Year2TotalNTS
    Year3TotalNTS
    Year4TotalNTS
    Year5TotalNTS
    LaunchYearTotalNTS
    Year2TotalNTSLC
    Year3TotalNTSLC
    Year4TotalNTSLC
    Year5TotalNTSLC
    I copied the default system proposal to Fields tab and sucessfully activated the DataSource.
    When I try to Read Preview Data at Preview tab, I'm getting the error "RSSDK:300 Column ProjectStatus not found". As this column exists, does anyone knows what can be going wrong?
    Also, when I try to upload data, the DTP runs green, but I receive the message "no data available".
    Tks and regards.

    Hi Githen,
    I have successfully connected the UD connect SQL server.
    in UD connection coming fields as TIMESTAMP , but IN BI 7.3 the same field as split the value like date and time.
    i have created the data source and getting this error.
    S:RSSDK:300 Column: responsestatuslastupdateddate_ not found
    Please help to me.

  • Steps to connect SQL Server to Oracle works but WHY ??

    The following steps is what I have to do in order to get SQL Server to talk to an Oracle database.
    These steps, for me, work 100% of the time. Any deviation from the following steps will result in failure.
    Rebooting the machine didn't make any difference between each of the steps.
    My question is why I have to install the client a second time?
    All the documentation that I have found at Oracle, Microsoft, or elsewhere state that I only need the InstantClient.
    =========================================
    Some server I don't have access to
    with Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit installed
    Windows XP SP3 - 32bit
    with Microsoft SQL Server 2005 SP3 installed
    The following steps are done on the Windows XP machine.
    1) install win32_11gR2_client
    Select: InstantClient (174.0MB)
    Path: C:\Oracle
    2) install ODTwithODAC112021
    Select: Oracle Data Access Components for Oracle Client
    Oracle Base: C:\Oracle
    Name: OraClient11g_home1
    Path: C:\Oracle\product\11.2.0\client_1
    3) Add entries for tnsnames.ora and sqlnet.ora
    4) Ensure environmental variable ORACLE_HOME is set to C:\Oracle\product\11.2.0\client_1
    5) SQL Server Management Studio
    Check "Allow Inprocess" for Oracle Provider OraOLEDB.Oracle
    Restart SQL Server
    Try to add link to Oracle - fails to connect
    "The test connection to the linked server failed."
    Additional information:
    An exception occurred while executing a Transact-SQL statement or batch.
    (Microsoft.SqlServer.ConnectionInfo)
    Cannot initialize the data source object of OLE DB Provider "OraOLEDB.Oracle" for linked server "ORACLEDB".
    OLE DB provider "OraOLEDB.Oracle" for linked server "ORACLEDB" returned message "".
    (Microsoft SQL Server, Error: 7303)
    6) install win32_11gR2_client
    Select: Administrator (1.02GB)
    Oracle Base: C:\Oracle
    Software Location: C:\Oracle\product\11.2.0\client_1
    7) Ensure environmental variable ORACLE_HOME is set to C:\Oracle\product\11.2.0\client_1
    8) Ensure tnsnames.ora and sqlnet.ora still exist and are unchanged.
    9) SQL Server Management Studio
    Restart SQL Server
    Add link to Oracle - Successful

    You actually installed the client *3* times there.
    I'm fairly sure install Instant client via win32_11gR2_client will not give you oraoledb. ODAC and administrator/runtime will though.
    You should only need install ODTwithODAC112021 OR win32_11gR2_client (with runtime or administrator option) and be able to connect using SQLServer.
    Greg

  • Unable to connect SQL server

    Hi All
    Can any one explain how we need to connect and extract data from SQL server from ODI
    Thanks
    Ranga

    Hi Ranga,
    Please see here :
    http://odiexperts.com/sql-server-connection/
    You could try with the inbuilt driver before downloading the MS specific one, set up your topology as per the post above.
    Hope this helps,
    Rgrds
    Alastair

Maybe you are looking for

  • I cannot open My MacBook pro

    i cannot open my macbook pro. It only loads halfway and stays there

  • How do I change me community username

    When I created my community username, I miss-spelled it.  How can I change it now?

  • CVD. Ecess , SHEcess Addl duty inventorising

    CVD. Ecess , SHEcess Addl duty are getting inventorising How to non inventorise these conditions? Pls help me out for settings for condn types and pricing schema regards

  • Indesign CS2 hyperlinks

    I could not export PDF due to application keep on quitting. But I still need my hyperlinks information. My question is, if I print .ps file and distilled it, does my hyperlinks could activate? Or is there any other way, seems I could not troubleshoot

  • After recent Iweb 09 update, when publishing site Iweb hangs

    Hi, After I did an Iweb update this week, I cannot publish my website anymore. The application hangs and has to be force quitted... I tried waiting for many minutes, without success. The Imac account is active and I can logon ok. I also updated my pa