Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-23-2008, 05:52 PM
Member
 
Join Date: Mar 2008
Posts: 1
subash is on a distinguished road
connection problem
Hi Friends this is my code to connect to database oracle10g but i am gettin error when java command the error is invalid oracle url specified can anybody solve this problem






import java.sql.*;
import java.lang.*;
import java.io.*;

public class condb
{
public static void main (String args[]) throws SQLException
{
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbcracle:thin@//localhost:1521:XE","SYSTEM","tiger");
System.out.println("connected");
}
catch(Exception e)
{
System.out.println(e);
}
}
}
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-22-2008, 03:40 AM
Member
 
Join Date: Apr 2008
Posts: 28
rico16135 is on a distinguished road
What is with people using the DriverManager?

JDBC is recommending that the DataSource interface should be used to create database connection objects instead of using the DriverManager class.

Implementations of the DataSource Interface
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-22-2008, 09:54 AM
Member
 
Join Date: Apr 2008
Posts: 91
javarishi is on a distinguished road
The database params can be given as a url. The format of url is

jdbcracle:<drivertype>:@<hostname>:<port>:<datab ase_sid>

In your case just replace the values as
Connection con=DriverManager.getConnection("jdbcracle:thin@ localhost:1521:XE","SYSTEM","tiger");

Try It Out.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-22-2008, 10:12 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,338
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
javarishi, seems there is a space between @ sign and the word localhost in the URL.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-22-2008, 10:14 AM
Member
 
Join Date: Apr 2008
Posts: 91
javarishi is on a distinguished road
Yaah Eranga, The space need to be deleted. No Space between @ and

localhost. Thanks.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 04-22-2008, 10:17 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,338
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Just want to let it know.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sql server connection problem tanvirtonu Database 1 03-31-2008 01:46 PM
no connection even Database 15 01-02-2008 02:50 PM
Java Serevr Connection Problem virendra_agarwal JavaServer Faces 0 12-19-2007 01:43 PM
Hibernator with eclipse : Problem in establishing the connection abhibh_1 Eclipse 1 12-18-2007 08:22 AM
JDBC driver connection problem creativehacker Database 3 07-10-2007 10:58 PM


All times are GMT +3. The time now is 05:44 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org