|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
JDBC : MySQL Connection
Greetings All,
I'm trying to use the mm.mysql.Driver to connect from JDBC to MySQL. I load the driver okay, but then get the following error message: PHP Code:
What port should I be connecting on? Do I need to configure JDBC or MySQL in someway? Any suggestions are very welcome. Thanks, Z. |
|
#2
|
||||
|
||||
|
How are you trying to connect (i.e. what commands are you using)?
__________________
Yawmark class Sig{public static void main(String...args){\u0066or(int \u0020$:"vÌÈÊ\"¤¾Àʲ¬Æ\"v¤Î¤\"²¤¨¸¬Æ".to\u0043h\u0061rArray() )System./*goto/*$/%\u0126//^\u002A\u002Fout.print((char)(($>> +(~'"'&'#'))+('<'>>('\\'/'.')/\u002Array.const(~1)\*\u002F)));}} |
|
#3
|
|||
|
|||
|
Greetings All,
I've included my basic class below, but I know it works because I tried it locally! So if anyone's want to know how to connect MySQL with JDBC here's some basic code, I'm using the MM driver, which you need to install and copy to the /jdk/jre/lib/ext directory. My problem is definately from the MySQL end, I cannot get a remote connection going and I really need to ![]() Any help is appreciated, Z. java class connect (I get the error just after connecting to MySQL hits the screen) PHP Code:
|
|
#4
|
|||
|
|||
|
Do you set up user on mysql table?
If so you may need to use "jdbc:mysql://localhost/databasename?user=username" |
|
#5
|
|||
|
|||
|
NOt sure but this might help
I think your problem may be with the way your presenting the connection to the db....I had quite a few problems when i first started but then settled on this config & havent had a problem since....of course this is single connection stuff which should be avoided in favor of connection pooling if you expect mulitple db connections. Anyways, here's how I do it:
Class.forName("org.gjt.mm.mysql.Driver").newInstance(); conn = DriverManager.getConnection("jdbc:mysql://localhost/[dbName]?user=[dbUserName]&password=[dbPassWord]"); Statement stmt = conn.createStatement(); Hope this helps Also your gonna have to catch 3 exceptions here or the compiler screams. They are InstantiationException, ClassNotFoundException & IllegalAccessException |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > JDBC : MySQL Connection |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|