aspose file tools*
The moose likes JDBC and the fly likes how can find mysql database address? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how can find mysql database address?" Watch "how can find mysql database address?" New topic
Author

how can find mysql database address?

Zaeed McColin
Ranch Hand

Joined: Jan 13, 2009
Posts: 90
hi, I use wamp
in mysql i create a DB
so in jdbc, how can find my DB address? and which driver have to use for connect to mysql
thanks


Open source
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You need the driver which is supplied by the DB manfacturer.
It usually comes along with documentation, you can find in there how to compose a valid JDBC URL.
Zaeed McColin
Ranch Hand

Joined: Jan 13, 2009
Posts: 90
thanks men so
I should use of "sun.jdbc.odbc.JdbcOdbcDriver"
the important part is what is the address of my mysql DB?



i dont have problem to connect to SQL Server
now what I have to do?
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
ArAsh Dex wrote:thanks men so
I should use of "sun.jdbc.odbc.JdbcOdbcDriver"
No, you should use the MySQL own JDBC driver.

the important part is what is the address of my mysql DB?



i dont have problem to connect to SQL Server
now what I have to do?
I wonder why you didn't wonder that there is no documentation along the ODBC bridge driver.

Get the MySQL JDBC driver and read its docs. That´s all.
Zaeed McColin
Ranch Hand

Joined: Jan 13, 2009
Posts: 90
o men you so kind thanks lot
so in doc said that use of "org.gjt.mm.mysql.Driver" as driver
so my application can not handle with this guy and give an Error what i have to do?
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
ArAsh Dex wrote:
so in doc said that use of "org.gjt.mm.mysql.Driver" as driver

No.
Go to the MySQL home page.
Go to the MySQL JDBC driver home page.
Download it and read the documentation over there.
Zaeed McColin
Ranch Hand

Joined: Jan 13, 2009
Posts: 90
OK
many thanks again
I downloaded related files,
there is a lot of file
i try to make a connection step in doc
OK if will have problem tell it and please answer me
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
I presume you have found the MySQL manual That was the Java connection section for the 5.1 version. There are other manuals for other versions.
Zaeed McColin
Ranch Hand

Joined: Jan 13, 2009
Posts: 90
many thanks Mr. Scholtz & Mr. Ritchie
OK i download a jar file (MySQL J-connector for JDBC) and now where I should put this guy and make a instance of it? I mean where do i should put them in my project
and can I use of "set CLASSPATH" for this guy?
many thanks Mr Scholtz & Mr. Ritchie .
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Depends on the environment you´re running. In general you just need to put the JAR in one of existing paths of the classpath or to add its path to the classpath. Some environments have default locations which are covered by the classpath where you can put JAR files in (e.g. WEB-INF/lib of a Java EE webapplication), but if you´re running it as a client Java application, then you need to take its path in the -cp or -classpath parameter the usual way.

And you usually shouldn´t make an instance of it. Just load the class using Class#forName(). Calling Class#newInstance() on it is just a workaround for some old and buggy JDBC drivers to get to register themselves with DriverManager. If you ever encounter such a driver, I would look for driver upgrade or different driver.
Zaeed McColin
Ranch Hand

Joined: Jan 13, 2009
Posts: 90
wow, many thanks, so I put it in my WEB-INF/lib and now application can handle with this
many thanks again
 
Consider Paul's rocket mass heater.
 
subject: how can find mysql database address?
 
Similar Threads
WebSphere 5.0 and mySql
JSP with MySQL DB
applet db access mediated by jsp db access
Detect if table exists
Using Commons dbcp with MySQL