Connectivity of database through applet

Hi to all,
I want to how to make the connectivity of database(preferably mySql) to java application through applet....

Possible answers to a more focused question:
Make sure the jar file containing the JDBC driver is in your applet's classpath.
Read the JDBC tutorial.
Make sure that the network connectivity between your client and the database is working.
Any of those sound right? No? Want to ask a more specific question?

Similar Messages

  • Connecting to database through applet

    hi friends
    I am trying to connect to sql database through applet but I cant.
    in fact it can not connect to database.
    plz any body tell me how can i do this. Thanks

    // class depends on
    //     msbase.jar
    //     mssqlserver.jar
    //     msutil.jar
    // these api's are part of Microsoft SQL Server 2000 Driver for JDBC
    // allso need JNDI file system Service provider: found @ sun http://java.sun.com/products/jndi/#DOWNLOAD12 the JNDI 1.2.X class librarys and
    //          File system provider 1.2 beta 3
    //     fscontext.jar
    //     providerutil.jar
    //      (jndi.jar) provided in java > 1.3*
    // to compile:
    // javac -classpath "C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;C:\j2sdk1.4.2_01\jndi\lib\fscontext.jar;C:\j2sdk1.4.2_01\jndi\lib\jndi.jar;C:\j2sdk1.4.2_01\jndi\lib\providerutil.jar" SQLTest.java
    import javax.sql.*;
    import java.sql.*;
    import javax.naming.*;
    import java.util.Properties;
    public class SQLTest extends Thread {
        String sqlServerUser = "sql login account";
        String sqlServerPWD = "sql password";
        String sqlServerName = "sql machine";
        String sqlServerPort = "1433";
        public SQLTest() {
        public static void main(String[] args) {
            (new SQLTest()).run();
        public void run(){
            Connection conn = null;
            try{
                Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://" + sqlServerName + ":"+ sqlServerPort + ";User=" + sqlServerUser + ";Password=" + sqlServerPWD + ";ProgramName=JAVA-jdbc;DatabaseName=Northwind");
                Statement stmt = conn.createStatement();
                ResultSet result = stmt.executeQuery(
                    "SELECT * from [Shippers]"
                if(result.next()){
                    System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                    while(result.next()) {   // for each row of data
                        System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                System.out.println("Getting a connection with drivermanager works fine");
            } catch(Exception e){
                e.printStackTrace(System.out);
            } finally{
                try{
                    conn.close();
                } catch(Exception e){
                    e.printStackTrace(System.out);
            if(true){return;}
    // try it with a datasource
            try{
            // Setting the context:
                com.microsoft.jdbcx.sqlserver.SQLServerDataSource sds = new com.microsoft.jdbcx.sqlserver.SQLServerDataSource();
                sds.setServerName(sqlServerName);
                sds.setDatabaseName("Northwind");
                sds.setNetAddress(sqlServerPort);
                Properties p = new Properties();
                p.put(Context.INITIAL_CONTEXT_FACTORY,     "com.sun.jndi.fscontext.RefFSContextFactory");
                Context ctx = new InitialContext(p);
                try{
                    ctx.unbind("jdbc/EmployeeDB");
                }catch(Exception e){
                }finally{
                    ctx.bind("jdbc/EmployeeDB",sds);
                DataSource ds = (DataSource)ctx.lookup("jdbc/EmployeeDB");
                conn = null;
                conn = ds.getConnection(sqlServerUser,sqlServerPWD);
                Statement stmt = conn.createStatement();
                ResultSet result = stmt.executeQuery(
                    "SELECT * from [Shippers]"
                if(result.next()){
                    System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                    while(result.next()) {   // for each row of data
                        System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                System.out.println("works with datasource");
            } catch(Exception e){
                e.printStackTrace(System.out);
            } finally{
                try{
                    conn.close();
                } catch(Exception e){
                    e.printStackTrace(System.out);
    }To give an applet special privileges you can specify the prifs in the java.policy file or sign the applet and choose "yes I trust" or "yes I allways trust" when the applet is loaded.
    To give special prifs with the java.policy, it should look like this:
    grant {
    permission java.lang.RuntimePermission "usePolicy"; // prevents the popup from showing for signed applets
    grant codeBase "file:C:/-" {
      permission java.security.AllPermission;
    grant codeBase "http://localhost/-" {
      permission java.security.AllPermission;
    };

  • How to connect 10g database through Enterprise manager???

    Hi All,
    I want to connect the database through Enterprise manager.
    My database is on 10g. Version is 10.1
    Please tell me the procedure to connect the database through E.M.
    Thanks and Regards,
    Prathamesh.

    Are you thinking of the Enterprise Manager supplied with Oracle9i? If yes - it doesn't work quite that way ... and the 9i java OEM is not compatible.
    Use the enterprise manager supplied with the 10g database, called the dbconsole (look for a service or start it using 'emctl start dbconsole') and access it using http://{localhost}:5500/em
    If that doesn't satisfy you, load the updated version of the OEM 9i java standalone from the 10g client disk.

  • How to Connect MySQL Database Through JTable?

    Hi,
    How to Connect MySQL Database Through JTable? anyone of u knows these concept please send me coding of that Part..
    Thanks,
    Guru..

    Start by reading the tutorials. There's a section on Swing which shows you how to use tables and a section on JDBC which shows you how to use SQL.
    And you can always search the forum as well since there are working examples of both posted on the forum.
    If you need further help with a specific problem then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
    Don't forget to use the [Code Formatting Tags|http://forum.java.sun.com/help.jspa?sec=formatting], so the posted code retains its original formatting.

  • Connecting to database through Captivate?

    Hello all...  
    I am using captivate4.
    My question description:    I have a requirement to connect to database through captivate(any  version) & retrieve the data & . I have "N" number of categories  in my course where the user will be given an option to select the  category according to his preference. I would like to place the  questions(category wise) in the data base (so that adding the additional  questions would be more flexible) & would like to call it into  Captivate quiz accordingly based on the user selection.
    How is this possible?
    Thanks & regards,
    Pullela.

    Have a look at Jim Leichliter's blog, if someone can do it it will be him:
    http://captivatedev.com/
    Lilybiri

  • Connecting to database through jsp

    i want to connect to database through jsp actually my requirement is i want to populate data in one list box in accordance with the selected option in another list box this must done in the same jsp and i must manupulate every thing java script can i found any solution to this with example

    just write ur code in scriplets if it is jdbc code & if it is html then write it out side scriplet.

  • How to connect Oracle database  through Microsoft ODBC?

    My ODBC Configuration:
    DSN name is :db
    Username : india
    Server :db.world
    Now, i am trying to connect with oracle database through SQL*plus or TOAD.
    But, it is giving the following error.
    ORA-03121: no interface driver connected - function not performed
    Database version : 9.2.0.1.0
    Operating System : Microsoft Windows XP
    ODBC Version : 2.575.1117.00
    I am trying to connect with the database like this:
    Username : india
    Password : india
    Database : ODBC:db
    Can i connect like this otherwise whether i need install any other supporting driver?

    Now, i am trying to connect with oracle database
    through SQL*plus or TOAD.
    But, it is giving the following error.
    ORA-03121: no interface driver connected -
    function not performed
    I am trying to connect with the database like this:
    Username : india
    Password : india
    Database : ODBC:db
    As already stated, you can not use the DSN in SQL*Plus (nor TOAD, afaik)!
    I can reproduce the error message with the following:
    C:\>sqlplus a/b@ODBC:c
    SQL*Plus: Release 11.1.0.6.0 - Production on Mon Aug 4 21:34:58 2008
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    ERROR:
    ORA-03121: no interface driver connected - function not performedLooking up the message, it says:
    Cause: A SQL*Net version 1 prefix was erroneously used in the connect string
    Looks like this has nothing to do with your DSN - it is more a matter of not using a proper connection string.
    If 'Test Connection' works then you should probably proceed to work with Crystal Reports, using the DSN in question.
    However, you should note that the old MS ODBC driver for Oracle was designed for OCI 7 (and for databases 7.x-8.x) and is now considered obsolete by both MS and Oracle.
    Deprecated MDAC components and MS KB Article 244661.
    Use the Oracle ODBC driver included with a supported Client version instead.
    Edit:
    Clarifying and adding references.
    Message was edited by:
    orafad

  • Need to Connect oracle database through EP

    Hi,
    my requirement is trying to connect oracle database and getting values from oracle database and displaying in portal (through EP)
    i created driver name called - sapdirect and import the jars like pOracle.jar in the driver and then i'll try to create datasource with the following configurations
    Name : sapdsn
    Aliases : sapalias
    Driver name: selected whatever i created before (ex: sapdirect)
    class : com.sap.portals.jdbc.oracle.OracleDriver
    url : jdbc:sap:oracle://10.145.4.171:1521;RAMS
    user name :scott
    password :tiger
    But the datasource can't create , the follwing error shown,
    Please gimme Solution for this.
    Even, all the services running oracle m/c.
    im wating for solution,
    Thanks in advance
    Bye for now
    Vasu
    Error:
    java.rmi.RemoteException: Error occurred while starting application in whole cluster and wait.; nested exception is:
    com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide execption: server ID 3739150:Exception while preparing start of application sap.com/JDBCConnector_sapdsn.xml.
    at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:679) at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:661) at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.startApplication(DataSourceManagerImpl.java:562) at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.deploy(DataSourceManagerImpl.java:261) at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.createDataSource(DataSourceManagerImpl.java:317) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.pj.jmx.introspect.DefaultMBeanInvoker.invoke(DefaultMBeanInvoker.java:58) at com.sap.pj.jmx.mbeaninfo.AdditionalInfoProviderMBean.invoke(AdditionalInfoProviderMBean.java:289) at com.sap.pj.jmx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:944) at com.sap.pj.jmx.server.interceptor.MBeanServerWrapperInterceptor.invoke(MBeanServerWrapperInterceptor.java:288) at com.sap.engine.services.jmx.CompletionInterceptor.invoke(CompletionInterceptor.java:400) at com.sap.engine.services.jmx.RedirectInterceptor.invoke(RedirectInterceptor.java:340) at com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain.invoke(MBeanServerInterceptorChain.java:330) at com.sap.engine.services.jmx.MBeanServerSecurityWrapper.invoke(MBeanServerSecurityWrapper.java:287) at com.sap.engine.services.jmx.MBeanServerInvoker.invokeMbs(MBeanServerInvoker.java:157) at com.sap.engine.services.jmx.ClusterInterceptor.invokeMbs(ClusterInterceptor.java:220) at com.sap.engine.services.jmx.ClusterInterceptor.invoke(ClusterInterceptor.java:803) at com.sap.engine.services.jmx.MBeanServerInterceptorInvoker.invokeMbs(MBeanServerInterceptorInvoker.java:102) at com.sap.engine.services.jmx.connector.p4.P4ConnectorServerImpl.invokeMbs(P4ConnectorServerImpl.java:61) at com.sap.engine.services.jmx.connector.p4.P4ConnectorServerImplp4_Skel.dispatch(P4ConnectorServerImplp4_Skel.java:64) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:291) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:183) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:119) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37) at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)Caused by: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide execption: server ID 3739150:Exception while preparing start of application sap.com/JDBCConnector_sapdsn.xml.
    at com.sap.engine.services.deploy.server.application.ParallelAdapter.sleepClientThread(ParallelAdapter.java:232) at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:113) at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesAndWait(ParallelAdapter.java:214) at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:4601) at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:677) ... 31 more

    Go to System Administration
    -> System Configuration
    -> System Landscape
    -> select a Folder where you want to store your system object
    -> right click -> New System
    -> in the wizard, select JDBC System
    -> enter values
    -> edit
    Then fill in the correct values as stated here:
    http://help.sap.com/saphelp_nw04/helpdata/en/84/d5df3df2ad685ae10000000a11405a/frameset.htm
    Then assign an Alias and enter some usermapping data for the system.
    You then can use the ConnectorService to get a native sql connection and fire statements. I'm sure you can find some examples here.
    Regards, Karsten

  • How to connect to database through TOAD(using tnsnames & sqlnet)

    Hi All,
    Hope everyone doing fine.. Actually i am new to oracle. Oracle9i and TOAD 9.7.0.51 are installed in my office PC. When I try to connect to the database through TOAD i am getting ORA-12560: TNS:protocol adapter error.
    And i've the tnsname details.
    Now i want to connect to the database.But i am not aware of the process about what to do. So Can anyone please help me on the above problem.
    Please give the steps to follow(one by one)
    Thanks,
    mkr

    Oracle9i and TOAD 9.7.0.51 are installed in my office PC.sqlplus> connect / as sysdba
    connected.
    Check your $ORACLE_HOME/network/admin/tnsnames.ora
    If it does not exist create as an example.
    example
    DBX =
    (DESCRIPTION =
    (ADDRESS_LIST =
         (ADDRESS = (PROTOCOL = TCP)(HOST = <host or ip>)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME =<sid_name>)
    set ORACLE_SID=SID
    tnsping DBX
    try to connect by toad after that it should work...

  • How to connect access database through oracle sql prompt

    i want to connect access database via oracle , i am trying to import all the data in Access table into oracle table how it is possible .
    A.R

    The simplest way, if You have already created tables in Oracle DB, is to open the Access MDB, link Oracle tables via ODBC and build a query to append rows reading from Access tables to Oracle tables.
    Hope this helps
    Max

  • Connecting Oracle DataBase through WebDynpro

    Hi,
    I created a Dynamic table, now I should display the data from Oracle Database. I tried in many various ways to connect to database, but the data is not retrieving.
    Can u explain the reasons and give necessary coding to retrieve the data.
    Its very very urgent.

    Hi
    I think you can do using the APIs provided by SAP.
    Check this link
    JDBC Reference
    or
    Try connectinc using lookup.
    try{
    InitialContext ctx=new InitialContext();
    javax.sql.DataSource ds=(javax.sql.DataSource)ctx.lookup("jdbc/SAPJ2EDB");
    java.sql.Connection con=ds.getConnection();
    java.sql.Statement stmt=con.createStatement();
    con.close();
    catch(Exception e)
    wdComponentAPI.getMessageManager().reportException("Exception "+e,true);
    Check this thread moreuseful.
    WebDynpro and Oracle Connection
    Please Check these threads
    Re: I need a j2ee code for getting data from oracle database
    Re: oracle connection
    Re: problem with displaying records from the database in a table ui element
    See this sample application and help
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/f0b0e990-0201-0010-cc96-d7ecd2e51715
    I hope these links will help u resolve your problem.
    All The Best
    Priyanka
    Do Reward Points

  • Visual Studio 2010 64bit cann't connect Oracle database through 64bit ODBC Driver

    Hi,
    I am developing an 64bit And-In software. My OS is windows7 64bit Ultimate. Developer tool is
    Microsoft  Visual Studio 2010 Ultimate 64bit any-CUP.
    Server is SUN server and Oracle database 10.2.0.5 64bit enterprise edition.
    I have installed instantclient-odbc-win64-10.2.0.5 on my computer.
    I am able to connect through the command line sqlplus user/pass@server.
    In date source(c:\windows\system32\odbcad32.exe), ODBC Driver connection successful.
    But in VS2010 C#, use Tools -> Connect Database,I get an error 193 (Oracle in
    instantclient10_2,c:\ora10_64\SQORA32.dll) cann't be loaded.
    SQORA32.dll is 32bit ODBC Driver or 64bit ODBC Driver?
    How can I connect database with vs2010 64bit?
    Regards

    There is no Visual Studio 2010 Ultimate 64bit as far as I know.  It's a 32 bit app.    Generally you'd need to install a 32 bit client to use the 32 bit tools.
    Hope it helps,
    Greg

  • Connect to Database through FORM builder

    I have configured 2 listeners to my database, both connect to the database ok but when I try to connect through my form builder I keep getting the error message
    "cannot resolve service_name" even though it's already connected through my net configuration assistant. Is there a seperate connect properties file for my form builder?

    You need to add an entry in the tnsnames.ora file that is in the Oracle_home that Forms is in.

  • Failed to access database through applet! Please help!

    Hi there,
    I'm writing an applet to connect to a Microsoft Access 97 database situated on the same computer where the applet is invoked.
    In appletviewer, it works fine...
    appletviewer hello.html -J-Djava.security.policy=policy.plybut how could i get it run on Internet Explorer 5.0?
    It always complains about failure to find the class...
    Abstract of the program is shown below:
    public class TestDB extends JApplet{
         private Connection connection;
         private JTable table;
         public TestDB() {
              String url = "jdbc:odbc:test";
              try {
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   connection = DriverManager.getConnection(url);
              catch (ClassNotFoundException cnfe) {
                   System.err.println("Failed to load JDBC/ODBC driver");
                   cnfe.printStackTrace();
                   System.exit(1);
              catch (SQLException sqle) {
                   System.err.println("Connection Err");
                   sqle.printStackTrace();
              getTable();
              setSize(450,150);
         private void getTable() {
              Statement st;
              ResultSet resultSet;
              try {
                   String que = "SELECT * FROM ChartOfAcct";
                   st = connection.createStatement();
                   resultSet = st.executeQuery(que);
                   displayResultSet(resultSet);
                   st.close();
              catch (SQLException sqle) {
                   sqle.printStackTrace();
    Thank you so much!
    Jess

    Thank you.
    If i were to use a policy file... what should i do to let the browser know about that? Sorry i'm a completey idiot on this.
    expected outcome:
    typing an URL on the browser, say, http://abc.com/test.html --
    an applet will load and the database in the root folder (applet is also in here) would be retrieved.
    Thank you.
    Jess

  • Can't connect to Database through JDeveloper with TNS connection

    Hello there,
    My work server we can connect to the server using TNS connection and it is working fine with Oracle SQL Developer that provide the type of connection. On the other hands, JDeveloper doesn't. I tried couple time to connect and I am unable to. Can someone tell me how to use a TNS type connection in JDeveloper?
    Thank you.

    I put server name for host name
    From http://asktom.oracle.com
    tell me what you consider to be the "server name".  do you want the sid?
    do you want the database name?
    do you want the global database name?  what is your concept of a "server name", we don't really have one  
    Ask Tom &amp;quot;Server Name of the Oracle Database&amp;quot;

Maybe you are looking for

  • Dll on Tomcat 6 got UnsatisfiedLinkError ... Can't find dependent libraries

    I created a dll file and it ran with no errors on the command line. But when i deployed it together with the java class file over to Tomcat 6.0\lib and ran it with a web application, Tomcat's log file reported: Exception in thread "Thread-12" java.la

  • Bug in preview portal doesn't display database list in back up section

    There seems to be a bug in the website back up option in the new portal. Even if you have connection strings defined it says: "You don't have any databases defined in the connection strings for this website" Unless I'm doing something wrong?

  • Nokia Lumia 610

    So i've been trying to update my nokia Lumia 610 to the latest version ( 7.10) and i keep get the  801812C1 problem... ive done the solution that http://support.microsoft.com/kb/2484484?toggle=step801812C1#801812C1 suggests and  still i cant update m

  • In Crystal Enterprise - how do I email if no records exist

    I havea report thatis an exception report. It is a daily import into another table by a 3rd party.  I run the report daily to test to see if there are no records.  If there are records in the report, then I do not want to email the report, however if

  • How to install software in solaris

    Hi, Sorry for posing this question in this forum. But I m helpless as in solaris forum I didn't get reply. I m new to solaris. Can you give me some details how to install a tgz file. thanks in advance