How to connect to a specific database in SQL server

Hi,
How can I connect to a specific database in SQL server? I used the following statement. But my table is inserted to the 'master' database in the SQL server. How can I insert my tables to the specific database tahta I have created before?
Connection con;
String sURL = "jdbc:microsoft:sqlserver://SERVER_NAME:1433";
con = DriverManager.getConnection ( sURL, sUsername, sPassword);

Hi,
When I use the syntax:
String sURL = "jdbc:microsoft:sqlserver://SERVER_NAME:1433/DATABASE_NAME;selectMethod=cursor";
it gives an error as follows:
problems connecting to jdbc:microsoft:sqlserver://SERVER_NAME:1433/DATABASE_NAME;selectMethod=cursor:
[Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL.
What is the way to connect to a specific database?

Similar Messages

  • Cannot connect to Oracle 11gR2 database from SQL Server 2005

    Both SQL Server (Windows) and Oracle (Linux) are in 64bit environments.
    I have done the following on a Windows 2008 R2 with SQL Server 2005:
    Install InstantClient from Oracle Database 11g Release 2 Client (11.2.0.1.0) for Microsoft Windows (x64) to C:\Oracle
    Install oledb from 64-bit ODAC 11.2 Release 3 (11.2.0.2.1) for Windows x64 by executing install.bat oledb c:\oracle odac
    Note: Not sure whether 11.2.0.2.1 version of ODAC will cause any problem since I cannot find 11.2.0.1.0 version.
    I have checked the Allow inprocess of OraOLEDB.Oracle provider in SSMS.
    I have executed sp_addlinkedserver @server = 'ORACLE_TEST', @srvproduct = 'Oracle', @provider = 'OraOLEDB.Oracle', @datasrc = '##.##.##.##:1521/TEST'
    The ##.##.##.## is the ip address of the Linux server which has the Oracle 11gR2 database TEST.
    I have executed sp_addlinkedsrvlogin @rmtsrvname = 'ORACLE_TEST', @useself = 'FALSE', @rmtuser = 'xxxx', @rmtpassword = 'yyyy'
    The xxxx is the oracle username and yyyy is the password for the oracle user xxxx.
    I know the oracle database TEST is up since I have setup connection in Oracle SQL Developer having:
    ##.##.##.## as the hostname
    1521 as the Port
    xxxx as the username
    yyyy as the password
    TEST as the service name
    When I click Test Connection for the linked server ORACLE_TEST in SSMS, it just hang.
    When I issue a query like select count(*) from oracle_test..xxxx.table1, it just run forever. I'm not so sure how to query an oracle table. I have also tried select count(*) from oracle_test.xxxx.xxxx.table1.
    When I retype the password in the Linked Server Properties, it just run forever.
    Do I need to create a tnsnames.ora on the Windows machine?
    Do I need to change the tnsnames.ora on Linux machine?
    I'm very new to Oracle.

    This forum is dealing with connections from an Oracle database to SQL Server - so the Oracle database is the driving site and this is the way round from your linked server set up.
    As you're suing the instant client you might post your issue in the instant client forum:
    Instant Client

  • How to connect and export specific schemas in SQL plus

    Hello,
    Wanted to clarify on a few things.
    - Can an Oracle 10g Release 10.2 client be used to connect to a oracle 10.1 database?
    - Is there an option to "connect" (not refer) to a specific schema, say "SchemaA" in SQL plus in order to run a specific sql code on this schema alone?
    - How can we export a specific schema as a dump file in SQL plus-what is the syntax? Assuming username=U;password = PW; Database=DB and schema = Sch
    Thanks a lot.

    - Can an Oracle 10g Release 10.2 client be used to connect to a oracle 10.1 database?
    Yes. O10gR2 client can be used to connect all version of Oracle instance.
    - Is there an option to "connect" (not refer) to a specific schema, say "SchemaA" in SQL plus in order to run a specific sql code on this schema alone?
    connect ShcemaA/pwd@hoststring.
    for e.g.
    connect scott/tiger@oradev
    conn scott/tiger@oradev
    - How can we export a specific schema as a dump file in SQL plus-what is the syntax? Assuming username=U;password = PW; Database=DB and schema = Sch
    Export can be done on Command promt not on SQLPLUS prompt.
    try the following to know all the parameters and usage of exp command.
    c:\> exp help=y
    exp scott/tiger FILE=scott.dmp OWNER=scott GRANTS=y ROWS=y COMPRESS=y

  • How to connect to a MySQL database in another server

    Dear friends,
    I am using Oracle SQL Developer 1.5.3 and I need to connect to a MySQL database located in another server.
    I am trying to create a new connection, informing connection name, username and password. Supposing that "Hostname" is the IP server address, I click on "Choose database", but I always receive the following error message: "Status : Failure - Cannot connect to MySQL server".
    Please tell me what I should do to solve this situation. Thanks in advance.
    Best regards,
    Franklin

    You need to configure your mysql database to accept connection from your PC for the user you used.
    For example,
    GRANT ALL ON *.* TO 'someuser'@'somehost';
    FLUSH PRIVILEGES;

  • How to connect to SP2010 content database from SQL Management Studio?

    I would like to migrate the SP 2010 Foundation content to 2013 Foundation.
    Both default installations with no external SQL server.
    When trying to connect from SQL Management Studio Express 2008 I get the error below.
    I'm using windows authentication and my domain admin account.
    tried all the steps  from
    this guide.
    What am I doing wrong here?
    Cannot connect to (local).
    ADDITIONAL INFORMATION:
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider:
    TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061)

    Hi,
    According to your description, my understanding is that you could not connect from SQL Management Studio Express 2008.
    Please try to connect to <MACHINENAME>\SQLEXPRESS or .\SQLEXPRESS instead of (local).
    A similar post for your reference:
    http://nali.org/post/96133108434/sql-server-a-network-related-or-instance-specific-error
    Best Regards,
    Wendy
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Wendy Li
    TechNet Community Support

  • Upgrading DPM 2012 SP1 to DPM 2012 R2 fails (DPM Setup is unable to connect to the specific instance of SQL Server Reporting Service (ID: 33431)

    The Background:
    1.  DPM 2012 SP1 was originally installed on a server with local SQL 2008 R2 instance (SQL was installed as part of DPM)
    2.  SQL database was upgraded to SQL 2012 SP1
    Now I want to upgrade DPM 2012 SP1 CU3 to R2.  It is throwing the following error.  Any help would be appreciated. 

    This absolutely fixed my issue.  I had upgraded my version of SQL and was then trying to upgrade DPM 2012 to 2012R2 and I could not figure out where the installation was querying old version of the reporting services.
    DPM Log Before:
    [6/4/2014 2:53:32 PM] Information : Query WMI provider for path of configuration file for SQL Server 2008 Reporting Services.
    [6/4/2014 2:53:32 PM] Information : Querying WMI Namespace: \\DPMServer\root\Microsoft\SqlServer\ReportServer\RS_MSDPM2012\v10\admin for query: SELECT * FROM MSReportServer_ConfigurationSetting WHERE InstanceName='MSDPM2012'
    [6/4/2014 2:53:32 PM] * Exception :  => System.Management.ManagementException: Provider load failure
    DPM Log After:
    [6/4/2014 3:25:36 PM] Information : SQL Server 2008 R2 SP2 instance MSDPM2012 is not present on this system.
    [6/4/2014 3:25:36 PM] Information : Query WMI provider for SQL Server 2008.
    [6/4/2014 3:25:36 PM] Information : Querying WMI Namespace: \\DPMServer\root\Microsoft\SqlServer\ComputerManagement11 for query: Select * from SqlServiceAdvancedProperty where ServiceName='MSSQL$MSDPM2012' and PropertyName='Version'
    [6/4/2014 3:25:36 PM] Information : SQL Server 2008 R2 SP2 instance MSDPM2012 is present on this system.
    [6/4/2014 3:25:36 PM] Information : Inspect context initialized with
    SQL Server namespace: \\{0}\root\Microsoft\SqlServer\ComputerManagement11
    Reporting namespace: \\{0}\root\Microsoft\SqlServer\ReportServer\RS_{1}\v11\admin
    SqlServerDetected: True
    [6/4/2014 3:25:36 PM] Information : Check if SQL Server 2012 Service Pack 1 Tools is installed.
    [6/4/2014 3:25:36 PM] Information : Inspect.CheckSqlServerTools : MsiQueryProductState returned : INSTALLSTATE_DEFAULT
    [6/4/2014 3:25:36 PM] Information : **********************************************************************************
    Thanks for This FIX!

  • SQL dependency OnChange event constantly when using a specific database on SQL server

    Hello
    I did some prototype dev using a new db I created on our dev SQL server instance and OnChange events only when the underlying data was changed. I tried the same thing with another database on the same server which is a replica of our live database. With
    this it just kept firing the event regardless of what activity there was in the table. I even created a totally empty table and used that for the query and it still fired on an empty table.
    Is there anything obvious that I need to do to this database to stop this? I'm pretty sure my c#is ok just confused by this
    Thanks,
    Dave.

    On the db where it works the properties in the SqlNotificationEventArgs are different to the one that does not work:
    So it looks as though for some reason it never gets to subscribe to this event.
    I tried using ssbdiagnose but to be honest I don't know what the From Service and To Service parameters are in my case.
    Here's what I got anyway:
    C:\Program Files\Microsoft SQL Server\100\Tools\Binn>ssbdiagnose -E -d BMC_Ecomm
    erce CONFIGURATION FROM SERVICE /test/initiator TO SERVICE /test/target
    Microsoft SQL Server 10.50.1600.1
    Service Broker Diagnostic Utility
    D  29997 W28SDEV05       Transport       Service Broker GUID is identical to tha
    t of database DynamicRouting on server W28SDEV05
    D  29997 W28SDEV05       Transport-TempRename Service Broker GUID is identical t
    o that of database DynamicRouting on server W28SDEV05
    D  29912 W28SDEV05       BMC_Ecommerce   Service /test/initiator was not found
    D  29912 W28SDEV05       BMC_Ecommerce   Service /test/target was not found
    D  29931 W28SDEV05       BMC_Ecommerce   There is no route for service /test/tar
    get
    D  29931 W28SDEV05       BMC_Ecommerce   There is no route for service /test/ini
    tiator and broker instance BB64B7AA-5C39-404B-B7A9-81D3756A4C60
    D  29964 W28SDEV05       BMC_Ecommerce   The master key was not found
    7 Errors, 0 Warnings
    Worth noting that the one that worked gets the same results with ssbdiagnose 
    SELECT service_broker_guid
    FROM sys.databases
    WHERE database_id = DB_ID(); 
    ran in DynamicRouting gives : 4AC2C25B-E612-44B2-BC43-687F918ABD16
    SELECT service_broker_guid
    FROM sys.databases
    WHERE database_id = DB_ID(); 
    ran in BMC_Ecommerce gives : BB64B7AA-5C39-404B-B7A9-81D3756A4C60

  • How to connect captivate file in a database (MS SQL SERVER 2008)

    Hi...
    How to connect captivate file in a database (MS SQL SERVER 2008) ???
    Kindly response please..
    thanks!!!

    Hi there
    See if the link below helps you out.
    Click here to view
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • How to connect external database(Ex:SQL Server/Tivoli)  from ABAP Webdynpro

    Hi,
    Any one have idea how to connect external database like SQL Server/Tivoli to access tables from WebDynPro ABAP.
    Please point to me some links if you have
    Thanks
    Praveen

    Hi,
    Please check out this link -
    FETCH DATA FROM ORACLE DATABASE USING Web Dynpro
    Regards,
    Lekha.

  • How to connect to a remote database in a lan??

    Hey guys......! I need to connect to a remote msaccess database in a lan and import its data into my mysql database.I know how to connect to a msaccess database using ODBC.But I don't know how to connect to a remote database without creating dsn in the machine where database is.One thing more...I want to know, how can I import data into my mysql database?? Is there any query for that or simply I have to select data from msaccess database and insert into tables of my database??Please, send me the source code in the forum itself and explain also.This is the last feature of my project.So I need to do it as soon as possible.

    If the mdb file in LAN, Just map the network drive.[Windows Explorer/Tools/Map Network Drive] in your system from which we need to access the remote mdb. Then go to ODBC Data Source Admin.. and create a new data source[Microsoft Access Driver] . After clicking the Select button, you will find a Network Drive will be visible on your Drives drop down. Select the map Drive, If not visible then just click the Network button there and map the network path where the mdb files reside. And use the JdbdOdbcDriver class to connect from java.

  • How to connect Java to oracle Database Express Edition?

    Anyone can help me?
    How to connect JAVA TO ORACLE DATABASE EXPRESS EDITION?

    I suggest you to read this article:
    http://wiki.oracle.com/page/JDBC
    Regards,
    Ricky

  • How To connect More Then One database

    How To Connect More the One Database In Single form.
    I want to use Access And Oracle In the Same Form.
    I want to Transfer data from Access file To oracle database.
    Chirag

    Hi,
    You can do this using EXEC_SQL package. Please see Note 115540.1 on metalink which describes how you can connect to Ms Access and Oracle using EXEC_SQL.
    Regards
    Kavitha Prakash
    Oracle Support

  • Not able to connect to database(MS SQL Server 2000) through JSTL tag

    Hi,
    I just want to retrieve some data from the database through a JSP page.I am using JSTL tags the code is as shown below. Whenever i execute this code i get an error message like this
    My Code:
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt" %>
    <sql:setDataSource var="datasource"
    driver="com.microsoft.jdbc.sqlserver.SQLServerDriver"
    url="jdbc:mssqlserver:sqlserver://SYS57:1433;DatabaseName= sree"
         user=" "
         password=" "/>
    <sql:query var="res" dataSource="${datasource}">
    SELECT * FROM books
    </sql:query>
    <html>
      <head>
        <title>A First JSP Database</title>
      </head>
      <body>
        <table border="1">
          <tr>
            <td>id</td><td>title</td><td>price</td>
          </tr>
          <c:forEach items="${res.rows}" var="row">
          <tr>
            <td><c:out value="${row.id}" /></td>
            <td><c:out value="${row.name}" /></td>
            <td><c:out value="${row.author}" /></td>
          </tr>
          </c:forEach>
        </table>
      </body>
    </html>error is this:
    javax.servlet.ServletException: Unable to get connection, DataSource invalid: "No suitable driver"
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
         org.apache.jsp.firstdb_jsp._jspService(org.apache.jsp.firstdb_jsp:93)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)root cause
    javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "No suitable driver"
         org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:308)
         org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:192)
         org.apache.jsp.firstdb_jsp._jspx_meth_sql_query_0(org.apache.jsp.firstdb_jsp:132)
         org.apache.jsp.firstdb_jsp._jspService(org.apache.jsp.firstdb_jsp:68)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)I am not clear with url attribute of setDatasource tag... I feel the error is because of that line only..... Kindly tell me how to specify the jdbc URL for MS SQL Server 2000 while using JSTL tags for connection.
    Thanks,
    Akshatha

    unable to rectify the error........ tried lot but all in vain...still trying........
    my current code is:
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt" %>
    <sql:setDataSource var="datasource" driver="com.microsoft.jdbc.sqlserver.SQLServerDriver"
    url="jdbc:microsoft:sqlserver://SYS57:1433;databaseName=sree" user="sa"
             password="dfgdfg"/>
    <sql:query var="res" dataSource="${datasource}">
      SELECT * FROM books
    </sql:query>
    <html>
      <head>
        <title>A First JSP Database</title>
      </head>
      <body>
        <table border="1">
          <tr>
            <td>id</td><td>title</td><td>price</td>
          </tr>
          <c:forEach items="${res.rows}" var="row">
          <tr>
            <td><c:out value="${row.id}" /></td>
            <td><c:out value="${row.name}" /></td>
            <td><c:out value="${row.author}" /></td>
          </tr>
          </c:forEach>
        </table>
      </body>
    </html>Thanks,
    Akshatha

  • How to repair database using SQL server 2008 and C#

    How to repair database in SQL server 2008 using C#
    Musakkhir Sayyed.

    Unfortunately your post is off topic as it's not specific to SQL Server Samples and Community Projects.  
    This is a standard response I’ve written in advance to help the many people who post their question in this forum in error, but please don’t ignore it.  The links I provide below will help you determine the right forum to ask your
    question in.
    For technical issues with Microsoft products that you would run into as an end user, please visit the Microsoft Answers forum ( http://answers.microsoft.com ) which has sections for Windows, Hotmail,
    Office, IE, and other products.
    For Technical issues with Microsoft products that you might have as an IT professional (like technical installation issues, or other IT issues), please head to the TechNet Discussion forums at http://social.technet.microsoft.com/forums/en-us, and
    search for your product name.
    For issues with products you might have as a Developer (like how to talk to APIs, what version of software do what, or other developer issues), please head to the MSDN discussion forums at http://social.msdn.microsoft.com/forums/en-us, and
    search for your product or issue.
    If you’re asking a question particularly about one of the Microsoft Dynamics products, a great place to start is here: http://community.dynamics.com/
    If you think your issue is related to SQL Server Samples and Community Projects and I've flagged it as Off-topic, I apologise.  Please repost your question and include as much detail as possible about your problem so that someone can assist you further. 
    If you really have no idea where to post your question please visit the Where is the forum for…? forum http://social.msdn.microsoft.com/forums/en-us/whatforum/
    When you see answers and helpful posts, please click Vote As Helpful,
    Propose As Answer, and/or Mark As Answer
    Jeff Wharton
    MSysDev (C.Sturt), MDbDsgnMgt (C.Sturt), MCT, MCPD, MCSD, MCSA, MCITP, MCDBA
    Blog: Mr. Wharty's Ramblings
    Twitter: @Mr_Wharty
    MC ID:
    Microsoft Transcript

  • Entity Framework doesn't create the database in SQL Server Management 2012, instead it just creates in (localdb)\v11.0 How to fix it?

    Hi, I'm Begginer in Entity Framework. Then I'm having some problems.
    I created my entities and I give Save Changes. (Ok)
    Then, I Tried to Connect with the database through Server Explorer, if I use the instance of the SQL Server Management Studio 2012(PC-PAULO\INSTANCIAPJ) as Server Name, the database doesn't appears but, if I use the the instance (localdb)\v11.0 the dabase
    appears.
    How to change the save to the SQL Server Management Studio 2012, I don't know where this (localDB)\v11.0 saves.
    Help-me Thank you :D

    Hello PauloJos,
    The code should be ok and it is really strange that the database is only created into the local database in your machine. I am wondering if it is related with the machine environment, could you please have a try with below demo on your machine which works
    on my side and if it is possible, please have a try to run your application on other machines to see if it works:
    class Program
    static void Main(string[] args)
    #region https://social.msdn.microsoft.com/Forums/en-US/00eff3c4-2336-4807-9212-e6f2a6c8812e/entity-framework-doesnt-create-the-database-in-sql-server-management-2012-instead-it-just-creates?forum=adodotnetentityframework
    using (CFDbContext db = new CFDbContext())
    db.Database.CreateIfNotExists();
    #endregion
    public class CFDbContext : DbContext
    public CFDbContext() : base("UltraFoda3") { }
    public DbSet<TestOne> TestOnes { get; set; }
    public class TestOne
    public int ID { get; set; }
    public string Name { get; set; }
    Config file is similar:
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </configSections>
    <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
    <parameters>
    <parameter value="v11.0" />
    </parameters>
    </defaultConnectionFactory>
    <providers>
    <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
    </entityFramework>
    <connectionStrings>
    <add name="UltraFoda3" connectionString="Data Source=YourServer;Initial Catalog=UltraFoda3;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
    </connectionStrings>
    </configuration>
    Regards.
    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.

Maybe you are looking for

  • Is there a workaround for wsdl with multi-part porttype with ESB?

    I am trying to implement a simple connection to a service with ESB, and have been successful in trials with several other products, but when I try to use the SOA adapter with ESB I get the following message. "The selected porttype is using a message

  • VZW Access manager freezing MacBook Pro

    I use VZW Access Manager to connect to the internet via bluetooth through my BlackBerry.  I am using the latest version of the software.  Sometimes VZW Access Mananger will freeze up after I have disconnected my phone.  I've tried to force quit the a

  • Weblogic throws NullPointerException when using ServiceControl.setTimeout

    We are invoking a SOAP service via a com.bea.control.ServiceControl that was generated from a WSDL (right click WSDL, Generate Service Control) using Weblogic 8.1.6. SOAP service execution is successful using an http and https endpoint. However, when

  • Problems trying to install CS5.5 Design Premium on a second machine

    I have downloaded the software on to my new machine but I am told that serial number is wrong, don't know where to go from here. I am pretty sure that this is only the second machine I have installed on - no obvious way of finding out though

  • Sleeping lion

    Regards RobinHood Attachments: ist2_9879977-sleeping-lion.jpg ‏70 KB