java - What exactly is a data source? What difference does it make? -
when tried found connection oracle database, had write
connection con = drivermanager.getconnection("jdbc:odbc:dan", "system", "noodles");
here, dan
info source name, isn't it? if created table called cbc
when info source dan
, if rename info source , come in farther rows table? difference make?
dan
name of odbc connection configured on machine. name not matter, long database configured connect same, doesn't matter if phone call dan
, mydatabase
or foobar
.
note specific way access database configured externally not thing jdbc in general, it's specific behaviour of jdbc-odbc bridge (which lets access odbc connections via jdbc).
other jdbc drivers (such mysql) utilize different syntax necessary configuration accessing database encoded in url: jdbc:mysql://mydbserver/mydbname
.
note jdbc-odbc bridge never intended production-quality db connections (it removed in java 8!). quick way utilize existing setup.
for oracle db connections should instead utilize appropriate type 4 driver oracle. drivers utilize url in form jdbc:oracle:thin:@//<host>:<port>/servicename
(generally speaking, part after jdbc:
identifies jdbc driver used).
java jdbc jdbc-odbc
No comments:
Post a Comment