How can i connect to a SQL Server 2000 database usgin JSP?

I need (URGENT) to connect to SQL Server 2000 databse using JSP. I do not know how to program using JSP, so if anyone has any code snippet please let me see it. What i need is to give my site some login/password security.
Anyone?
Thx.

just create an ODBC of your database from control pannel -> administrative tools -> data sources (ODBC) ,double click it .....
go to the tab SYstem DSN , click on ADD button. select the driver for your connection. it will be the last one in the list "SQL Server".
click Next then give ur DSN name there, description and Server Name , on next give your username and password of SQL server. when it will be connected to the server celect your database from there and hence there will be an ODBC bridge same as in case of MS Access.
code for connecting to ODBC is
// DSN-NAME same as in System DSN.
// username and password are of your databse
try
          url = "jdbc:odbc:DSN-NAME";
          Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
          connect = DriverManager.getConnection( url,"username","password" );
          catch ( ClassNotFoundException cnfex ) {
                    setErrorMsg( cnfex.getMessage() );
          catch ( SQLException sqlex ) {
                    setErrorMsg( sqlex.getMessage() );
          catch ( Exception ex ) {
                    setErrorMsg( ex.getMessage() );
Now you are connected to the SQL Server ..... use connect object for further processing .........

Similar Messages

  • Connecting to an SQL Server 2000 Database

    Hi!
    I am trying to make a connection to a database created from SQL Server 2000. However, I don't know how to do it. Can anyone please help? How would the Java code different from the code we use to connect to a database created from MS Access?
    jt

    Hi Hartmut,
    I have a program which inserts a date into a table.
    I use a dsn configured to a database (as you've
    suggested). In my case, it's MS Access:
    private boolean writeToMSAccess(Hashtable ht) {
        // Build sql statement;
        // we use of # around the date, for MS Access.
        String sql =
            "INSERT INTO Broadcast (Author, BroadcastTime, Title, Length, BroadcastGroup,Link) " +
            "VALUES ('" + (String)ht.get("author") + "', " +
            "#" + date + "#, " +
            .... + "')";
            // Connect to the database, execute the sql.
            // dsn is passed into the program
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            String url = "jdbc:odbc:" + dsn;
            Connection conn = DriverManager.getConnection(url, login, password);
            Statement  stmt = conn.createStatement();
            stmt.executeUpdate(sql);
            stmt.close();
            conn.close();
            return true;
        }Now if I point my DSN to SQL Server for example,
    it won't work b/c of the # marks. I'd have to change:
        String sql =
            "INSERT INTO Broadcast (Author, BroadcastTime, Title, Length, BroadcastGroup,Link) " +
            "VALUES ('" + (String)ht.get("author") + "', " +
            "#" + date + "#, " +
            .... + "')";to:
        String sql =
            "INSERT INTO Broadcast (Author, BroadcastTime, Title, Length, BroadcastGroup,Link) " +
            "VALUES ('" + (String)ht.get("author") + "', " +
            "'" + date + "', " +
            .... + "')";My question is, is there a way to detect which database
    my dsn points to, so that I can determine at run-time
    whether or not to use the # marks?
    Or is there another way around this problem?
    Any help is greatly appreciated!
    -alex

  • How can you connect to MS SQL Server through Oracle 9i?

    i.e. we want to connect through a stored procedure and NOT a form. Our live DB is still in 9i.

    CKPT wrote:
    user12240205 wrote:
    i.e. we want to connect through a stored procedure and NOT a form. Our live DB is still in 9i.we want to connect through a stored procedure -- connect through stored procedire? i never heard. can you please post your views this information is not enough.CREATE PROCEDURE proc1 (p_sqlsever_credentials varchar2, p_status OUT boolean) IS
    BEGIN
    -- Connect to SQL Server using p_sqlsever_credentials
    -- Execute Stored Procedure (SP) in the SQL Server DB passing paras to it.
    -- If SP in SQL Server is successful then SP will COMMIT in SQL Server
    -- If failure it will be rolled back there.
    -- SP will return status
    -- Pass the status to the calling program
    END;
    /

  • Cant export worksheet when connected to MS SQL Server 2000

    SQL Developer version: 1.5.1
    Hello,
    I have a connection to an SQL Server 2000 database. I can select data with an "order by" clause but I receive an error when I attempt to do an "Export --> xls" on the worksheet data. I dont think this was a problem prior to SQL Developer 1.5.
    No export error occurs if the "order by" cluase is removed.
    Here is an example of a select stmt that generates the error.
    select LastName, FirstName, EmployeeID
    from northwind.dbo.employees
    order by LastName, FirstName
    Here are the error details:
    First dialog box error text: The ORDER BY clause is invalid in views, inline functions, derived tables, and subqueries, unless TOP is also specified.
    Second dialog box error text (after clicking Details button):
    java.lang.NullPointerException
         at oracle.dbtools.raptor.dialogs.export.ColumnPanel.addColumnsToTree(ColumnPanel.java:85)
         at oracle.dbtools.raptor.dialogs.export.ColumnPanel.showPanel(ColumnPanel.java:61)
         at oracle.dbtools.raptor.dialogs.export.ColumnPanel.<init>(ColumnPanel.java:45)
         at oracle.dbtools.raptor.dialogs.actions.TableExportAction.showPanels(TableExportAction.java:297)
         at oracle.dbtools.raptor.dialogs.actions.TableExportAction.launchDlg(TableExportAction.java:197)
         at oracle.dbtools.raptor.format.ui.ExportContextMenuListener$1.actionPerformed(ExportContextMenuListener.java:137)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    The table selected from is not a view, inline function, derived table, or subquery (as the error suggests). I can work around the problem by adding "TOP nnnn" to the select statement but this shouldn't be required.
    Any suggestions?
    Thanks.

    I confirmed that this is not a problem in SQL Developer 1.2.1.32.13. It started with 1.5. In 1.5.1.5540 I can successfully run the query and see the output in the Results tab. Only the Export has the error.

  • How can I connect to a windows server from a mac book pro

    How can I connect to a windows server from a mac book pre?

    I have a Dell Power Edge T110 ii in the office that has files and software I need to access when away from the office, when I am on the road I use a mac book pro and an iPad.
    I am sorry if I am being a bit vague but this is all new to me, I have tried 3 IT guys but they can not find a way.
    Any help is greatly appeciated.

  • How can I connect to a UNIX server to execute a command?

    How can I connect to a UNIX server and execute a command using PowerShell? My shell script is sitting on one server, while the UNIX box is on another.
    also, I don't like the idea of hardcoding a username/password within the script file in order to do so.
    -Nothing to see. Move along.

    You will need a library to handle SSH connections.
    I'm using SSH.NET, you can find info on it here : http://www.powershelladmin.com/wiki/SSH_from_PowerShell_using_the_SSH.NET_library
    It has a bit of a learning curve but the web site has some fairly good tutorials.

  • Connect to MS SQL Server 2000 data warehouse

    Hi,
    I use a MS SQL Server 2000 database for my web application where I use JSP. I suppose to create data warehouse using MS SQL Server's Data Transformation Service. But I don't know it's possible to connect to a MS SQL Server's data warehouse using JSP. So I want to know is it possible to connect to data warehouse using JSP and if it is how to do it? Thank you.

    You can certainly connect to M$ SQL Server using the JDBC driver:
    http://www.microsoft.com/downloads/details.aspx?FamilyID=4f8f2f01-1ed7-4c4d-8f7b-3d47969e66ae&displaylang=en
    Connecting to a data warehouse is no different from any relational database. (My understanding is that a data warehouse usually means a star schema implemented in a relational database.) This will connect you.
    If you're not familiar with JDBC, you might need the tutorial:
    http://java.sun.com/docs/books/tutorial/jdbc/

  • Connecting to MS SQL server 2000 with SSMS 2008

    Hello
    I have been trying to solve this problem for months now and searched lots of threads, but no success.
    Our office has sql server 2000 database, which is installed on Windows XP. I am given 'sa' password. On my computer, which is Windows 7, I have SSMS 2008. I am able to connect to mentioned server using Windows ODBC data source and with MS Access.
    The problem is no matter what I tried, I could not connect with SSMS. When I go to "Server Connection" > "Server Name" > > "Network Servers" in SSMS, the needed server is found automatically, but I still fail to connect.
    I know that SSMS 2008 should be able to connect to server2000 (or maybe I am wrong?).
    Please help.

    TITLE: Connect to Server
    Cannot connect to SOFODB.
    ADDITIONAL INFORMATION:
    Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. (Microsoft SQL Server, Error: -2)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-2&LinkId=20476
    BUTTONS:
    OK
    I am not sure but this type of issue can be resolved by increasing time out.Time out sec is 15 by default change it to 60 or 120 and see if you can connect if not please revert.
    When you are connecting using SSMS click on option button...In connection properties page see for connection timeout...change it to 60 or 120 .See if this works
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • How to use OEM to moniter sql server 2000

    Hi,
    I need to learn How to use OEM to moniter sql server 2000.
    Can anyone help me and give me some website or documents
    to read?
    So I can learn to do this job.
    Thanks.

    See Note 115302.1 in Metalink.oracle.com
    in how to use OEM Diagnostic pack addon for SQL Server
    Or search for
    oem "user events"
    to build your own monitor script.

  • How to load oracle data into SQL SERVER 2000?

    how to load oracle data into SQL SERVER 2000.
    IS THERE ANY UTILITY AVAILABLE?

    Not a concern for an Oracle forum.
    Als no need for SHOUTING.
    Conventional solutions are
    - dump the data to a csv file and load it in Mickeysoft SQL server
    - use Oracle Heterogeneous services
    - use Mickeysoft DTS
    Whatever you prefer.
    Sybrand Bakker
    Senior Oracle DBA

  • Tell me how to format a date retrieved from a MS SQL Server 2000 database?

    Tell me how to format a date retrieved from an MS SQL Server 2000 database for various uses in my JSP page?

    Or if you want to use JSTL instead of a scriptlet see:
    http://forum.java.sun.com/thread.jspa?threadID=676754&tstart=0

  • How to load data to a SQL Server 2000 from a text file ( fixed / delimited)

    I am a navie user to ODI, just installed some time back. And I wanted to load text data ina file ( fixed length/ delimited ) to SQL server 2000 database.
    Iam intrested to know the steps I need to take to achieve this. I mean for example first creating topology,next designer..
    Could you please provide some books/articles or any documents that talt about these steps clearly one-by-one.

    Hi,
    Oracle Data Integrator - Getting Started with an ETL Project
    follow this manuel step by step and you will be able to load data from file to any database...

  • SQL Server 2000 database GETDATE() default for field

    I have a SQL Server 2000 database where the createDate field
    has a default value of GETDATE() and the data type is datetime. It
    is inserting the date just fine, but I do not want to capture the
    time along with the date. I only want the date to be entered. How
    can I accomplish this? Thanks!

    IF you only wanted to store the date, then yes you would use
    that as the column default value.
    createDate datetime default convert(datetime,
    convert(varchar, getDate(), 102), 102)
    However, as paross1 cautioned be sure you understand you will
    only be capturing the date from now on. If you change your mind
    later, and decide you need both the created date and time, you will
    be seriously out of luck. A safer choice might be to keep the date
    and time, and use convert in your queries instead.

  • Manipulate data of a SQL SERVER 2000 database

    Problem:
    I need to manipulate data of a SQL SERVER 2000 database that it’s installed in a Windows
    from an oracle 8.1.7 database that is installed in a red hat linux server.
    This access has to be made in a procedure created in this Oracle instance.
    The Solution’s Environment:
    - oracle 8.1.7 database - red hat linux server - ORCL INSTANCE
    - SQL SERVER 2000 version 5.0 database - Windows server - SQLSERV INSTANCE
    - Oracle 8.1.7 database - windows 2000 professional server - HSDB INSTANCE
    We did the following steps:
    1) We installed an oracle database 8.1.7 in the windows 2000 professional.
    The name of this instance is HSDB.
    2) We configured the HSODBC resource in this HSDB instance so as to access the SQLSERVER database.
    3) It was created a database link in the ORCL instance (LINUX) so as to access the oracle HSDB instance
    4) It was created a procedure in the ORCL instance that insert data into the SQLSERVER database using the database link.
    This procedure pass through the following instances:
    ORCL Instance (database link) => HSDB Instance (HS Resource) => SQLSERV Instance
    5) When I execute this simple procedure of the ORCL Instance, the process takes a long time. Although if I run this insert on a SQL Plus, the transaction ends fast. Why it’s happening?
    PROCEDURE PRC_TESTE(P_CD_CMC7 IN VARCHAR2) IS
    BEGIN
    BEGIN
    INSERT INTO VSolicitacaoRetirada@MSSQLDB
    ("CMC7")
    VALUES
    (P_CD_CMC7);
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR '||SQLERRM);
    END;
    COMMIT;
    END;
    Tranks

    I modified the PRC_TESTE procedure and worked fine when I made the following change.
    In spite of using the P_CD_CMC7 parameter on the INSERT command, I included a fixed value. Althoug I can´t use this fixed value. What it can be?
    Example:
    CREATE OR REPLACE PROCEDURE PRC_TESTE(P_CD_CMC7 IN VARCHAR2)
    IS
    BEGIN
    BEGIN
    INSERT INTO VSolicitacaoRetirada@MSSQLDB
    ("CMC7")
    VALUES
    ('123456');
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERRO NO INSERT '||SQLERRM);
    END;
    COMMIT;
    END;
    ------------------------------------------------------------

  • Problem converting captured SQL Server 2000 database to Oracle

    Java(TM) Platform     1.6.0_17
    Oracle IDE     2.1.1.64.45
    Versioning Support     2.1.1.64.45
    After creating MWREP user, granting it privileges and creating the migration repository, I have captured a small SQL Server 2000 database (1 table), but after performing "Convert to Oracle", I get the message that it has transformed correctly, but no converted model is shown. I was originally using the JRE supplied with SQL Developer 2.1.1, but replaced that with 1.6 U17 after researching the problem here.
    The only message in the Migration Log is as follows:
    Catalog RAC, Schema dbo coalesced to single schema dbo_RAC
    The following message appears in the console:
    SELECT DISTINCT(REF_ID_FK), REF_TYPE FROM MD_ADDITIONAL_PROPERTIES WHERE PROP_KEY IN (?) AND CONNECTION_ID_FK = ?
    I have tried this with a more complex database, with no luck.
    Any thoughts?

    I did an offline capture.
    I used Tools->Migration->Third Party Database Offline Capture->Create Database Capture Scripts to generate scripts OMWB_OFFLINE_CAPTURE.BAT, SS2K_BCP_SCRIPT.BAT and sqlserver2000.ocp. Then the SQL Server DBA ran OMWB_OFFLINE_CAPTURE.BAT and sent me the output.
    I used Tools->Migration->Third Party Database Offline Capture->Load Database Capture Scripts Output to capture the model into the repository successfully.

Maybe you are looking for

  • How to change system preferences programatically, 10.5 issue

    I know about the "preferences" api. Like SCPreferencesCreate(NULL, CFSTR("SomeName"), NULL); and get value and all the rest. In fact, I know how to read all the preferences. The problem is changing them. I do not care which one, any of them. You see,

  • Limited functionality in Win 8.1 Start Screen when using Server 2012 GPO

    I'm testing Windows 8.1 EE with Server 2012 for a school where I need to configure a common layout that users are unable to change. So, I have configured a start layout and exported it via Powershell to the server and it works fine across my various

  • Aol always opens as junk mail

    when i receive e-mail from friends who use aol, my i-mail program always categorizes them as junk mail even though i have the sender in my address book. i have checked and the "exception" box for "senders address in my address book" is checked in jun

  • How to Display Varient on selection screen?

    Hi All, the requirement is i need to display the varient on selection screen as  Paramente. Display Varient   /STANDARD   as a paramente on selection screen. Please let me know how to do it. Regards, Kumar Moderator message: very basic, please search

  • Delivery notification

    Hi, in the "imsimta qm top" output: Count Subject ====== ======= 9 Delivery Status Notification (Failure) 7 Delivery Notification: Delivery has failed What is the difference between the two subjects ? Regards