Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

error on connecting to mm.mysql database

1 view
Skip to first unread message

Ireen Meho

unread,
Sep 28, 2001, 8:11:05 PM9/28/01
to

Dear people,

I need some help urgently.
I have developed a java application which is supposed to connect to mySQL
server through mm.mysql driver (ver. 1.0) but can't do it although the
driver is loaded fine.

The application is a part of an applet and with an appletviewer there is
no problems.

what could be wrong?

/*******************************
Here's what the compiler say's:
/*******************************

properties set
loading driver
driver loaded: org.gjt.mm.mysql.Driver@81eeb50
connecting database

java.lang.ExceptionInInitializerError: [exception was java.lang.NullPointerException]
at org.gjt.mm.mysql.MysqlIO.<init>(MysqlIO.java:line unknown, pc 0x825a85f)
at org.gjt.mm.mysql.Connection.<init>(Connection.java:line unknown, pc 0x8257ce3)
at org.gjt.mm.mysql.Driver.connect(Driver.java:line unknown, pc 0x8252325)
at Data2.connect(Data2.java:47)
at Data2.main(Data2.java:15)

java.lang.NullPointerException
at java.util.StringTokenizer.<init>(StringTokenizer.java:34)
at java.util.StringTokenizer.<init>(StringTokenizer.java:30)
at java.lang.NativeLibrary.getLibraryNames(NativeLibrary.java:36)
at java.lang.Runtime.loadLibrary(Runtime.java:132)
at java.lang.System.loadLibrary(System.java:144)
at java.net.InetAddressImpl.<clinit>(InetAddressImpl.java:18)
at java.lang.Throwable.printStackTrace(Throwable.java:line unknown, pc 0x8200d88)
at org.gjt.mm.mysql.MysqlIO.<init>(MysqlIO.java:line unknown, pc 0x825a85f)
at org.gjt.mm.mysql.Connection.<init>(Connection.java:line unknown, pc 0x8257ce3)
at org.gjt.mm.mysql.Driver.connect(Driver.java:line unknown, pc 0x8252325)
at Data2.connect(Data2.java:47)
at Data2.main(Data2.java:15)

/****************************************
and that is my code:
/****************************************


import java.sql.*;
import java.util.*;

public class Data2 {

private Connection c;
Driver drv;
final static private String _driver = "org.gjt.mm.mysql.Driver";
static private Statement stmt;
ResultSet results;

public static void main(String[] arg){
Data2 data = new Data2();
Connection conn = data.connect();
try{
stmt = conn.createStatement();
}
catch(Exception e){
e.printStackTrace();
}
}

public Connection connect(){
System.out.println("setting properties");
Properties P = new Properties();
P.put("jdbc.drivers", _driver);
System.setProperties(P);

Properties prop = new Properties();
prop.setProperty("user", "itsme");
prop.setProperty("password", "myPWD");

System.out.println("properties set");

try{
System.out.println("loading driver");
drv = (Driver)Class.forName("org.gjt.mm.mysql.Driver").newInstance();
System.out.println("driver loaded: " + drv.toString());

System.out.println("connecting database");
/*this is where the error appears*/
c = drv.connect("jdbc:mysql://server.alfanet.ee/myBase", prop);
System.out.println("connected to database");
}
catch(Exception e){
e.printStackTrace();
}

return c;
}
}

/*******************************

Thanks for any help!

wbr,
Ireen

Pete Hall

unread,
Oct 13, 2001, 7:27:57 AM10/13/01
to
have you tried adding

?username=myname,password=mypassword

to the URL?

"Ireen Meho" <ire...@math.ut.ee> wrote in message
news:Pine.GSO.4.33.01092...@math.ut.ee...

0 new messages