How i can make  my own connection in java source of a jsp page

How i can make my own connection in java source of a jsp page (How to get connection from JNDI datasource address) ?
imagine that i have a rowset in a web page , now i want to do some operation using
plain JDBC , so i will need a connection object.
I tried to get one of my rowsets connection but it return null ?
what is best way to retrive a connection from JNDI datasource that we define for our project?
for example if i have
myRowSet.setDataSourceName("java:comp/env/jdbc/be");
in web page constructor
now i want a pure connection from the same datasource ? JNDI
Thank you

It is not hard to get your own connection from datasource.
in your case you need to do like the the following code.
i provide sample to show you how to catch the exception and create an statement .
Connection con =null;
try{
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/be");
con = ds.getConnection();
java.sql.Statement st =con.createStatement();
}catch(SQLException sqlex){
sqlex.printStackTrace();
sqlex.getNextException().printStackTrace();
catch(NamingException nex){
nex.printStackTrace();
hth
Masoud kalali

Similar Messages

  • I just got my Mac and I used my family Apple ID. It had all of my parent's information, I added my e-mail.I wanted to make my own Apple ID, but I couldn't use the same e-mail address again! How do I delete this information so I can make my own Apple ID?

    I just got my Mac and I used my family Apple ID. It had all of my parent's information, I added my e-mail.I wanted to make my own Apple ID, but I couldn't use the same e-mail address again! How do I delete this information so I can make my own Apple ID?

    Wendy P-G wrote:
    I just got my Mac and I used my family Apple ID. It had all of my parent's information, I added my e-mail.
    It is not clear how or where you "added" your email, but you cannot create an Apple ID using an email address that is already associated with another Apple ID.
    If that is what you did, delete that email address from your family's Apple ID. You should be free to create a new one.
    Do all that by starting here: https://appleid.apple.com/
    Select "Manage your Apple ID". Log in with your family's Apple ID and then delete your own email address wherever it appears.
    Save Changes, log out, and create the new one using the same website. This time select "Create an Apple ID".
    Please don't forget your security questions, and be sure to specify a "rescue email address" that is separate from all other Apple IDs. You will avoid so many problems that way...

  • To turn on my ipod, I get an image of connection to iTunes, but when you update iTunes, nothing happens. I restarted the iPod manually several times peero still appears the same image. how I can make it work?

    to turn on my ipod, I get an image of connection to iTunes, but when you update iTunes, nothing happens. I restarted the iPod manually several times peero still appears the same image. how I can make it work?

    Restore the ipod

  • How i can make my new ipad as a mobile phone?

    How i can make my ipad as a mobile phone?

    There are VOIP (Voice Over Internet Protocol) apps on the app store that will let you make voice calls on any internet connection.  Some are free, some have fee's associated with them.  There are also apps that allow you to send SMS/MMS messages, most are free, some have fees.  There are also apps that have VOIP and messaging capabilities in one app.  Search around and find what suits your needs.

  • How i can make multilanguage application .. take his vlues from database

    How i can make multilanguage application .. take his values from database
    and can change labels of massages , buttons ,text fields and name of columns in run time
    in jdevelpoer11g
    great thank

    Hi,
       I think that there is not a standard support for retrieving multilanguage texts from database in ADF. What we did is to implement our own ResourceBundle that retrieves the translated text from custom database tables. We also introduced a cache for optimizing the access to the translations.
    I hope this can help,
    Juanjo

  • Game center open on my old device stolen how i can make it logout ?

    i have my new iPhone and i play game called iron force its working normal suddenly i find message connection lost becouse i login from other device its my old device iPad i lost so the person who use my old device he kick me from the game not from game center… is there anyways i can make my game center logout or forgeten from the old device ???

    i didn't see him enable with my old iPad becouse i already change the password and id apple ...
    the problem he still have game center games on the iPad that can let him go inside my game normal … if he logout from my game center there he will not go inside again and the same with the games he can't go inside but how i can make him logout this is the problem..
    by the way he use 7.1.2 old version on iPad and i use iPhone 5 now

  • How i can make my computer is a server 4 my website ?

    i mean i want to make my hard disk is a server for my website , ok its going like that :
    lets say that i have this domain : www.alasmar.com & i forward it to my ip but u know the ip is changed every time i connect to the net so how i can make this in the right way ?
    i hope u can help me
    thanx

    lets say that i have this domain : www.alasmar.com &
    i forward it to my ip but u know the ip is changed
    every time i connect to the net so how i can make
    this in the right way ?http://www.dyndns.org can help here.

  • HT2736 How i can make a gift card code

    How i can make a goft card code

    Your question is rather unclear. Can you please explain in more detail what it is you wish to accomplish? If you are not comfortable writing in English, try posting in your native language.
    Regards.

  • How I can make a folder contain pictures &video an...

    sorry if there are mistakes
     i have n95 v 31.0,017
     how I can make a folder in SD card contain pictures &video and I dont want them  appear in studio
    I dont want to use a files browser  and hide my files and i dont want  to use an application  to encrypt them because  I just  want to sort my pictures in a folder  and my video in afolder.
    thank you  
    Solved!
    Go to Solution.

    You can also try to remove them from the images folder and the  My videos folder, because this is where the Gallery will look for pictures and videos, and put them in another folder then reorganize them in sub folders within your new folder
    Show your appreciation. Hit that kudos button real hard

  • How I can make a call on my iPad 3G

    I buy a secondhand iPad first generation with 3G but how I can make a call ?

    Also forget about sending SMS text messages - the iPad internal modem is only used for cellular data.
    Can be a real pain when using prepaid SIMcards that require sending SMS text messages to top up
    3G prepaid internet on an iPad

  • How I can make a request to send to apple workshop?

    how I can make a request to send to apple workshop?

    Go to this web page:
    http://www.apple.com/support/ipad/service/faq/
    Choose your country as appropriate and follow the instructions under "how do I obtain service".
    Regards.

  • How i can make a backup without separate hdd?

    How i can make a backup without seperate hdd?

    how i can partition the hd? please step by step...
    today it's my first apple-day ... i was 18 years windows user
    While I agree with everyone else, get a second disk and backup to that disk, I will point you in the directory of partitioning.
    Applications -> Utilities -> Disk Utility
    Disk Utility may or may not be able to carve a new partition out of your existing partition, depending on whether the end of the current partition is unused so the current partition can be reduced in size and a new partition added.
    It may be necessary to use an external disk, clone your internal disk using SuperDuper or Carbon Copy Cloner (both free to use when creating a full clone), then partition your internal disk, and finally restore the external clone to the internal disk again using SuperDuper or Carbon Copy Cloner.
    If you do not want to get a 2nd disk, then consider using an on-line service such as CrashPlan, Carbonite, Mozy, etc... for the files you absolutely cannot aford to loose.

  • How i can make valid java appliacation and how

    i am novice in java and i want to make good and valid application that i can run from server any body can tell me how i can make this or any link for any project online or build on net with deployment details
    A.R

    JAXP api can be used to read xml from java
    Cheers :)

  • How i can make in the same action 2 condition (check the exemple down)

    how i can make in the same action 2 condition (check the exemple down)
    this is an example and I really thank you for helping me(any body plz)
    http://www.2shared.com/file/DPpdgC_a/Exemple_Edge.html

    1. make each rectangle a symbol  (Symbol_1 and Symbol_2) and uncheck autoplay()
    2. Delete your code on the click event and put the following code in compostion ready:
    var toggle=true;
    function btnPlay(){
              if (toggle){
                        toggle=false;
                        sym.getSymbol('Symbol_1').play();
              else{
                        toggle=true;
                        sym.getSymbol('Symbol_2').play();
    sym.$('Ellipse').click(function(){
              btnPlay();

  • How I can make actions for write the file name in front image

    Hello All
    How I can make actions for write image(file)  name in front the image automatically in photoshop cs3.
    Thanks

    This script tutorial might be helpful:
    http://av.adobe.com/russellbrown/CaptionMaker_SM.mov

Maybe you are looking for

  • Adobe master collection cs3 error message

    hi, when i try to convert a document using adobe acrobat 8 professional i get the follwoing message - adobe pdf printer failed to create the PDF file - does anyone have and ideas that might help solve this problem? thanks paul.

  • Scripting Preflight options In Design (CS4)

    I'm trying to make a script that will install predefined Preflight options in In Design. This is my script till now : tell application "Adobe InDesign CS4" try make new preflight profile with properties {name:"TEST"} end try tell preflight profile "T

  • ICloud decreased, lost my photos

    iTunes recently decreased my iCloud. In which most of my photos were deleted. They were not back up o. A computer. How can I get them back?

  • Catching of SMTP Failure in JDeveloper 11g in Email Service

    Hi, I am having a requirement to send Email using Jdeveloper. I have configured the email service but for a test case i made a change of port in my SMTP server but the email service did not returned any error in JDeveloper and i was not able to catch

  • My phone turned off will not turn back on or charge does anyone know what to do?

    my phone is 2 months old not a scratch or anything and mysteriously was off when i went over to it will not turn on when i put it on the charger it isnt dead. and will not turn on does anyone know whats wrong?