Connecting with database using setproperty over SOAP connection

The following method connects to a MySQL database.
public void setDBDriverName(String in)
     dbDriverName = in;
public void setDBConnection(String in)
     dbConnection = in;
public void connectToMySQLDatabase() throws SQLException
     if(dbCon == null)
             try
                Class.forName(dbDriverName);     // SQL driver
                dbCon = DriverManager.getConnection(dbConnection);           // JDBC url
                s = dbCon.createStatement();
                   catch (Exception e)
                System.out.println("Could not connect to database using " + dbConnection + " at " + dbDriverName + " : " + e.getMessage());
     else
            System.out.println("Could not connect to databse : Already connected");
}The method is part of a webservice, in which I use setproperties to set the database connection because the webservice must work with different types of databases like Oracle and MySQL.
<jsp:useBean id="ContactHistorieClassid" scope="request" class="proxy.soap.ContactHistorieClassProxy" />
     <jsp:setProperty name="ContactHistorieClassid" property="DBConnection" value="org.gjt.mm.mysql.Driver" />
     <jsp:setProperty name="ContactHistorieClassid" property="DBDriverName" value="jdbc:mysql://localhost/contacthistorie" />
     <jsp:setProperty name="ContactHistorieClassid" property="clientID" value="1" />
<%
     ContactHistorieClassid.connectToMySQLDatabase();
%>What am I doing wrong here?

Forgot what happens, sorry. After trying to use the ContactHistorieClassid.connectToMySQLDatabase() method, my server console tells me that it cannot connect to the database, even though it returns the values as they were set in the setproperty.
When I manually enter the values like this...
Class.forName("org.gjt.mm.mysql.Driver");     // SQL driver                
dbCon = DriverManager.getConnection("jdbc:mysql://localhost/contacthistorie"); .. it works properly. So the setproperties are executed as the should be.

Similar Messages

  • Can I connect with Database using Session Bean

    Hi,
    I am new to EJB. I have small doubt.
    can I connect with Database using Session Bean.
    Regards,
    Murali.

    Double post of http://forum.java.sun.com/thread.jspa?threadID=687239&tstart=0

  • Issue in connection with database using SQL Developer.

    Hi,
    I am facing a problem in connecting to a remote oracle database, below are the configuration setting which i am trying to use in sql developer to make the connection
    TNS Configuration Details (SUDHIR)
    SUDHIR=
    (DESCRIPTION=
    (ADDRESS=
    (PROTOCOL=TCP)
    (HOST=52.12.xxx.xxx)
    (PORT=1526)
    (CONNECT_DATA=
    (SERVICE_NAME=sudhir)
    User : system
    Password : xxxxxxxxxxx
    Database : sudhir
    Connect as : Normal
    I got the above credential details from Onsite team I need to connect this in my local sytem SQL Developer I am proving the connection as below
    Hostname : 52.12.xxx.xxx
    Port : 1526
    Service Name : sudhir
    Username : xxxxxxxxxxxxxx
    password : xxxxxxxxxxxxx
    I get following error when say test connection in sql developer.
    "The Network Adapter could not establish the connection."
    Please suggest me using the above details how to make the connection success. Please let me know.
    Thanks
    Sudhir
    Edited by: BluShadow on 30-Mar-2012 11:56
    data anonymised by moderator

    (o_0)
    Hopefully for you, the machine is not reachable from internet !
    Your giving online everything needed to log in as system ! that is quite dangerous. I guess the "Onsite team" would be pretty mad discovering that.
    You should edit your previous post before too much people get to it.
    Regarding your problem, I guess you can't get to the machine itself (maybe in a different network).
    Can you try to ping it from your computer ?ping 51.17.130.121
    This is a made-up IP, you'll have to replace with yours

  • Restric the connection with database

    Hi friends,
    My oracle server is 9i. can i restrict the connection with database using application type.
    Eg MSACCESS.EXE
    Regrds
    upul Indika.

    Create this trigger under the sys user. note a user with DBA privilege can still login with msaccess.
    CREATE OR REPLACE TRIGGER trg_logon AFTER logon ON DATABASE
    DECLARE
    tool_name VARCHAR(50);
    BEGIN
      SELECT MAX(PROGRAM)
      INTO tool_name
      FROM sys.v_$session
      WHERE audsid = sys_context('USERENV',   'SESSIONID');
      IF(tool_name = 'MSACCESS.EXE') THEN
        raise_application_error(-20003,   'Login with MSACCESS.EXE is not allowed!');
      END IF;
    END;Regards

  • How to connect with database in JBuilder?

    Hi,
    I try to connect with database in JBuilder7, but the connection is failed. please tell me what is wrong? thanks!
    In connection tab:
    Driver: sun.jdbc.odbc.jdbcodbcDriver
    URL: jdbc:odbc:MS Access Database:h:\onlinestore\database\book.mdb
    Error:
    com.borland.dx.dataset.DataSetException: [Microsoft][ODBC Driver Manager] Data source name too long
    Jun

    URL: jdbc:odbc:MS Access Database:h:\onlinestore\database\book.mdbshould be jdbc:odbc:DBname:book.mdb

  • Datareader is not able to connect with database-Urgent

    Hi All,
    All of a sudden the Datareader component in my ML experiment is not able to connect with database with the following error:
    [ModuleOutput] DllModuleHost Error: 1 : Program::Main encountered fatal exception: Microsoft.Analytics.Exceptions.ErrorMapping+ModuleException: Error 0000: Internal error ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: The value's length for key 'password' exceeds it's limit of '128'.
    Module finished after a runtime of 00:00:00.2031339 with exit code -2
    Module failed due to negative exit code of -2
    It complains about the password being long-but the same credentials I have been using for the last 2 months and still able to use it to run sql queries on that same database using the management portal.
    It appears that Azure encrypts the password and that encrypted password is too long...just my guess after looking that the output.Inside Ml it just says as internal error
    Would appreciate if someone can point to the issue at the earliest...(There is a demo early next week)
    Subscription:Enterprise,
    LOCATION: East Asia
    Regards,
    Biswajit

    Hi,
    Please check this url:
    https://studio.azureml.net/Home/ViewWorkspace/bc85d4f81d2246c4b1430eb395229a3a?&hashSeg=#Workspaces/Experiments/Experiment/bc85d4f81d2246c4b1430eb395229a3a.f-id.11776ae4400f4c1aa9f58308c30810fa/ViewExperiment
    which is an experiment which I created doing save as of the experiment in which the data reader works.
    I stripped everything except the data reader and setup the rest of the components...I finally have to write the results back ,so also pulled a Writer component.
    Now,the data reader works fine..but the Writer fails:
    Error 0071: Incorrect username "acnadmin" or password is passed
    Strangely,its the same credentials set in the DataReader.
    Looks like all the DataInput/Output components created recently only have the problem.
    Once again,while the datareader in this case passes the password in plain text,the writer encrypts,hence fails.

  • How to connect oracle database using jsf

    how to connect oracle database using javaserver faces with connection pooling

    Here is one way...
    http://jakarta.apache.org/commons/dbcp/

  • What is the advantage of using RMI over socket connection

    plz tell me guys what is the advantage of using RMI over socket connection bcoz inherently RMI also uses socket connection.so what is the exact difference in between thm and what is the advantage of using RMI over socket connection.

    i knew tht bt i http://www.catb.org/~esr/faqs/smart-questions.html#writewell
    How To Ask Questions The Smart Way
    Eric Steven Raymond
    Rick Moen
    Write in clear, grammatical, correctly-spelled language
    We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
    So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal — in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
    Spell, punctuate, and capitalize correctly. Don't confuse "its" with "it's", "loose" with "lose", or "discrete" with "discreet". Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
    More generally, if you write like a semi-literate b o o b you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate b o o b to save two entire keystrokes.

  • Error: unable to connect to database using user system. please check privil

    Hi All,
    i have 2 oracle databases in my system (ORCL,RR). i am able to connect both databases i sql prompt. but in ggsci prompt not able to connect rr database due to below error
    dblogin userid system, password tiger.
    Error: unable to connect to database using user system. please check privil
    Can you please help me to connect RR database also in GGSCI promt.
    Thanks
    Raja

    Did you try with RR database tns name or sid while connecting ?
    If No then try this ,
    GGSCI (ATP) 6> DBLOGIN USERID SYSTEM@<tns alias name>
    Password:
    Successfully logged into database.
    HTP
    Annamalai.

  • Error: Unable to connect to database using connection_pool

    Hi experts
    I have created repository and reports on my windows machine using ODBC , Now i have tranfered this to on unix with OCI, But when i am connecting to my dtabase it is showng the error:
    Error: Unable to connect to database using connection_pool
    Please suggest how to resolve this..

    Have you install the Oracle client in your Unix server?

  • Problem regarding to connection with database

    while opening the SQL server 2008,it is unable to connect with database, showing as error 2

    1. Make sure SQL Server Service is running
    2. If a named instance, make sure SQL Server browser service is running
    3. Make sure SQL Server is configured to allow remote connections
    4. Examine the SQL Server error log for messages confirming that SQL is listening on the expected network interfaces and ports
    5. Test server connectivity with PING from the client machine
    6. Test port connectivity using TELNET or PowerShell to the server and port (from step 4) from the client machine.  For example
    a. TELNET <server-name> 1433
    b. PowerShell: 1433 | % { echo ((new-object Net.Sockets.TcpClient).Connect("YourServerName",$_)) "server listening on TCP port $_" }
    7. Check firewall settings if step 5 or 6 connectivity test fails
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Connecting with RADIUS using SQLDeveloper

    Hi,
    It's possible to connect to databases using RADIUS authentication (user identified externally) with SQLDeveloper without Oracle Net Client installed ??
    Thanks,
    Àngel

    Try add this (external authentication) in the
    Feature Requests

  • Ias connection with database

    administration/net8 configuration assitant then i modify the listener to the port by now i can connect with sql plus but i can connect to the data base with a web form
    i have the following error
    frm-40735 exception ora-03114
    the strig i put on the form for connection work on client environment for the same database on the same pc
    i know with the sqlnet.log file i have a network problem i do not how to resolve
    i format the drive reinstalling nt server then the ias then the database this the same problem
    how to resolve this?
    nb i have only one pc
    null

    Try to use next directive format:
    PlsqlDatabaseConnectString rac1:1521:bop.database.db ServiceNameFormat
    Default format for string argument of PlsqlDatabaseConnectString directive is SIDformat (it's working for sid of your db instances) or TNSformat, but not ServiceNameFormat
    see dads.readme file for more infos ...
    WBR

  • Forms 6 not connecting with Database 10g

    I can not connect Oracle forms 6 with database 10g

    795192 wrote:
    I can connect to sql plus but i cannot connect my forms 6 with database 10g. getting the following error:
    ORA-12154: TNS: could not resolve service name=================================
    ORA-12154: TNS:could not resolve the connect identifier specified
    This error means one thing, and one thing only. The client could not find the specified entry in the tnsnames.ora file being used.
    As a follow-on to that statement, remember that when you use a dblink, the database in which the link is defined is acting as a client to the database that is the target of the link. So in this case, the tnsnames.ora file on the host of your source should have an entry for your target db, as defined in the db_link.
    And for the umpteenth time ... this error has <b><i><u>NOTHING</u></i></b> to do with the status of a listener. The connection request never got far enough to reach a listener. If anyone tells you to check a listener in response to ora-12154, they are not paying attention, or do not understand how TNS works. This error is the equivalent of not being able to place a telephone call because you don't know the number of the party you want to reach. You wouldn't debug that situation by going to the other guy's house and testing his telephone, or by going to the phone company and testing the switchboard. And you don't debug a ORA-12154 by checking the listener. If I had a top ten list of "Incredibly Simple Concepts (tm)" that should be burned into the brain of everyone who claims to be an Oracle DBA, it would include "ORA-12154 Has Nothing To Do With The Listener".
    =================================
    A couple of important points.
    First, the listener is a server side only process. It's entire purpose in life is to receive requests for connections to databases and set up those connections. Once the connection is established, the listener is out of the picture. It creates the connection. It doesn't sustain the connection. One listener, with the default name of LISTENER, running from one oracle home, listening on a single port, will serve multiple database instances of multiple versions running from multiple homes. It is an unnecessary complexity to try to have multiple listeners or to name the listener as if it belongs to a particular database. That would be like the telephone company building a separate switchboard for each customer.
    Second, the tnsnames.ora file is a client side issue. It's purpose is for address resolution - the tns equivalent of the 'hosts' file further down the network stack. The only reason it exists on a host machine is because that machine can also run client processes.
    Assume you have the following in your tnsnames.ora:
    larry =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
        (CONNECT_DATA =
          (SERVICE_NAME = curley)
      )Now, when you issue a connect, say like this:
    $> sqlplus scott/tiger@larrytns will look in your tnsnames.ora for an entry called 'larry'. Next, tns sends a request to (PORT = 1521) on (HOST = myhost) using (PROTOCOL = TCP), asking for a connection to (SERVICE_NAME = curley).
    Where is (HOST = myhost) on the network? When the request gets passed from tns to the next layer in the network stack, the name 'myhost' will get resolved to an IP address, either via a local 'hosts' file, via DNS, or possibly other less used mechanisms. You can also hard-code the ip address (HOST = 123.456.789.101) in the tnsnames.ora.
    Next, the request arrives at port 1521 on myhost. Hopefully, there is a listener on myhost configured to listen on port 1521, and that listener knows about SERVICE_NAME = curley. If so, you'll be connected.
    What can go wrong?
    First, there may not be an entry for 'larry' in your tnsnames. In that case you get "ORA-12154: TNS:could not resolve the connect identifier specified" No need to go looking for a problem on the host, with the listener, etc. If you can't place a telephone call because you don't know the number (can't find your telephone directory (tnsnames.ora) or can't find the party you are looking for listed in it (no entry for larry)) you don't look for problems at the telephone switchboard.
    Maybe the entry for larry was found, but myhost couldn't be resolved to an IP address (say there was no entry for myhost in the local hosts file). This will result in "ORA-12545: Connect failed because target host or object does not exist"
    Maybe there was an entry for myserver in the local hosts file, but it specified a bad IP address. This will result in "ORA-12545: Connect failed because target host or object does not exist"
    Maybe the IP was good, but there is no listener running: "ORA-12541: TNS:no listener"
    Maybe the IP was good, there is a listener at myhost, but it is listening on a different port. "ORA-12560: TNS:protocol adapter error"
    Maybe the IP was good, there is a listener at myhost, it is listening on the specified port, but doesn't know about SERVICE_NAME = curley. "ORA-12514: TNS:listener does not currently know of service requested in connect descriptor"
    =====================================

  • [b]How can i connect with database(oracle 9i) from form developer at runtim

    Hi Friends,
    My problem is as follows, please show me a way.
    Let's asume, I have form (developed in 6i) which has database data block. Now, at form level a have assigned on_logon trigger and I have written the following PL/SQL statement in that trigger:
    begin
    null;
    end;
    So, when I run this form without connecting to database It does not prompt for a connection. Now I have button lebeled as "Connect" in this form, when user will click on it it will display a window having text boxes to enter user name, password and database name; once the user fill those text boxes and click on a button lebeled as "Ok" then the form runtime environment should be connected with database as per information provided by user. Here to mention that the user already been created, only the connection will be stablished. For example: I want to connect the form with database as "scott/tiger@oradata9i".
    To do this, what PL/SQL command statement should i write in that "OK" button's "when_button_pressed" trigger?
    If any of you know about this please help me.

    Hi
    I've answered this question already. If I understand you right, you can use 'LOGON' built-in of Forms. Take a look into documentation.

Maybe you are looking for

  • Multiple Animations in a PDF

    I have followed a tutorial on animations in .pdfs made by Right Hemisphere and have got things working.... ...however, the tutorial plays back ALL of the animations in the u3d at once. I have created a u3d file with Deep Creator which has mutiple ani

  • IPhone thinks Bluetooth is still active

    My wife and I have identical iPhone 4s' with iOS 5.1, but... She has her iPhone paired to the bluetooth in a Subaru Forester and the connection is fine, mp3s play thru the speakers, etc...the problem is that when she turns off the vehicle and goes in

  • Controlling iTunes

    I have recently installed iTunes onto my computer running Windows XP Home. I have a few .wma files that I have been converting to .mp3 files (successfully). I do not understand how to keep iTunes from creating folders for artists that did a song with

  • Audigy 2 zs problems help!!

    i have a audigy 2 zs with latest drivers and have had no problems whatsoever with any games until i recently installed close combat, first to fight. The problem i have is ingame i have no music or gun fire effects. Spoke to take 2 who said it is a so

  • How to make an extruded column twist like a barber pole????

    I'm new to Illustrator (and using Windows CS3), and I've been getting properly acquainted with the filters and effects mostly through trial and error. Nonetheless, I need to make a rectangular bar with a pronounced twist - like a barber pole. I start