*
The moose likes JDBC and the fly likes invalid SQL url specified Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "invalid SQL url specified" Watch "invalid SQL url specified" New topic
Author

invalid SQL url specified

wenkai hsieh
Greenhorn

Joined: May 25, 2002
Posts: 1
Dear Pro.:
i tried to test my driver version, and the error message is:
Exception in thread "main" java.sql.SQLException: Invalid Oracle URL specified
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:273)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:182)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at Test.main(Test.java:6)
i used thin driver, my database is wendb, user is wen, pwd is wen
below is my tnsnames.ora data:
# TNSNAMES.ORA Network Configuration File: D:\oracle\ora81\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
WENDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = wenkai)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = WENDB)
)
)
INST1_HTTP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = wenkai)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = WENDB)
(PRESENTATION = http://admin) )
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
what would be the correct URL:
Connection conn=DriverManager.getConnection ("jdbc racle:thin:@?:?:?","wen","wen");
thank you...
Roger Thornhill
Author
Greenhorn

Joined: May 15, 2002
Posts: 25
Does
Connection conn = DriverManager.getConnection ("jdbc: oracle:thin:@wendb","wen","wen");
work?
[ May 26, 2002: Message edited by: Greg Barish ]
Amy Smith
Greenhorn

Joined: Jul 26, 2001
Posts: 24
The URL I use looks like this:
"jdbc:oracle:thin:USERID/PASSWD@HOST:PORT:DBNAME";
So...
"jdbc:oracle:thin:wen/wen@wenkai:1521:wendb"
Try that.
You may have to specify the full name of the host/server. I specify HOST.companyname.com for the host name.
--Amy
[ Edited by Dave to remove smilies ]
[ May 28, 2002: Message edited by: David O'Meara ]

Amy Smith<br />Java Developer<br />Haworth, Inc.<br />amy.smith@haworth.com
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: invalid SQL url specified