Skip to main content

Connecting to DB2 database

2 replies [Last post]
zrc
Offline
Joined: 2008-06-26
Points: 0

I am trying to connect to DB2 UDB 8.2 database with a mobile device (Symbol MC70).
Are there any other ways connecting to the database (compatible with mobile devices) except using DriverManager class(which is not supported by all kinds of mobile java platforms) and DataSource class (which for some reason doesn't work)? Do I have to include some kind of special jar file in my project, that would allow me to connect to DB2 database?

Datasource Example (not working):
//DB2DataSource db2Source = new DB2DataSource();
DB2SimpleDataSource db2Source = new DB2SimpleDataSource();
db2Source.setUser("User");
db2Source.setPassword("Pass");
db2Source.setDatabaseName("Test");
db2Source.setDriverType(4);
db2Source.setPortNumber(Port);
db2Source.setServerName(ip);
Connection conn = db2Source.getConnection();
conn.close();

Errorrs in the Websphere device developer 5.6:
The project was not built since its classpath is incomplete. Cannot find the class file for javax.naming.Referenceable. Fix the classpath then try rebuilding this project.

Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Hinkmond Wong

phonemeadvanced@mobileandembedded.org wrote:
> I am trying to connect to DB2 UDB 8.2 database with a mobile device (Symbol MC70).
> Are there any other ways connecting to the database (compatible with mobile devices) except using DriverManager class(which is not supported by all kinds of mobile java platforms) and DataSource class (which for some reason doesn't work)? Do I have to include some kind of special jar file in my project, that would allow me to connect to DB2 database?
>
> Datasource Example (not working):
> //DB2DataSource db2Source = new DB2DataSource();
> DB2SimpleDataSource db2Source = new DB2SimpleDataSource();
> db2Source.setUser("User");
> db2Source.setPassword("Pass");
> db2Source.setDatabaseName("Test");
> db2Source.setDriverType(4);
> db2Source.setPortNumber(Port);
> db2Source.setServerName(ip);
> Connection conn = db2Source.getConnection();
> conn.close();
>
> Errorrs in the Websphere device developer 5.6:
> The project was not built since its classpath is incomplete. Cannot find the class file for javax.naming.Referenceable. Fix the classpath then try rebuilding this project.
>
>
> Thanks
> [Message sent by forum member 'zrc' (zrc)]
>
> http://forums.java.net/jive/thread.jspa?messageID=287029
>

Hi zrc,

I'm cc'ing Mayuresh and Rick Hillegas in hopes they can answer your
question (above) on the advanced@phoneme.dev.java.net mail forum. It
sounds like a Java DB (Derby) specific question...?

Hinkmond

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net

Rick Hillegas

I just got back from vacation and saw this mail. Please bear with my
blindness: this thread seems to involve connection to a DB2 database,
not a Java DB (Derby) database. I don't know what knobs need to be set
to connect to DB2 from a mobile device, but you appear to be on the
right track of using a DataSource rather than a DriverManager to get a
connection.

It may be helpful to look at the demo code which shows how to connect a
mobile device to a Java DB (Derby) database. That code can be found in
the Java DB distribution in the demo subtree. Just look for the
SimpleMobileApp source code.

I hope I'm not completely talking past your issue here,
-Rick

Hinkmond Wong wrote:
> phonemeadvanced@mobileandembedded.org wrote:
>> I am trying to connect to DB2 UDB 8.2 database with a mobile device
>> (Symbol MC70).
>> Are there any other ways connecting to the database (compatible with
>> mobile devices) except using DriverManager class(which is not
>> supported by all kinds of mobile java platforms) and DataSource class
>> (which for some reason doesn't work)? Do I have to include some kind
>> of special jar file in my project, that would allow me to connect to
>> DB2 database?
>>
>> Datasource Example (not working):
>> //DB2DataSource db2Source = new DB2DataSource();
>> DB2SimpleDataSource db2Source = new DB2SimpleDataSource();
>> db2Source.setUser("User");
>> db2Source.setPassword("Pass");
>> db2Source.setDatabaseName("Test");
>> db2Source.setDriverType(4);
>> db2Source.setPortNumber(Port);
>> db2Source.setServerName(ip);
>> Connection conn = db2Source.getConnection();
>> conn.close();
>>
>> Errorrs in the Websphere device developer 5.6:
>> The project was not built since its classpath is incomplete.
>> Cannot find the class file for javax.naming.Referenceable. Fix the
>> classpath then try rebuilding this project.
>>
>>
>> Thanks
>> [Message sent by forum member 'zrc' (zrc)]
>>
>> http://forums.java.net/jive/thread.jspa?messageID=287029
>>
>
> Hi zrc,
>
> I'm cc'ing Mayuresh and Rick Hillegas in hopes they can answer your
> question (above) on the advanced@phoneme.dev.java.net mail forum. It
> sounds like a Java DB (Derby) specific question...?
>
>
> Hinkmond
>

---------------------------------------------------------------------
To unsubscribe, e-mail: advanced-unsubscribe@phoneme.dev.java.net
For additional commands, e-mail: advanced-help@phoneme.dev.java.net