Results 1 to 5 of 5
  1. #1
    mangesh.gho is offline Member
    Join Date
    Jan 2012
    Posts
    10
    Rep Power
    0

    Question Creating database connection in linux

    i have made a java application using "textpad" & have used MS access database. But now the the problem is, in my college, there is linux & also "root" directory has access prohibited. so i am unable to use command "create database" in mysql. So what do i do to create database?
    what changes i have to made in my coding? please help..

    for connection, i have used this simple code
    Java Code:
    Statement st;
    Connection con;
    ResultSet rs;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:Mangesh");
    Last edited by mangesh.gho; 01-04-2012 at 11:39 AM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,442
    Rep Power
    18

    Default Re: Creating database connection in linux

    You could give Derby a go.
    Use that embedded possibly (since I suspect this is a single user thing?).
    That way you can have the db held in the users directory, so no problem with privileges.

  3. #3
    mangesh.gho is offline Member
    Join Date
    Jan 2012
    Posts
    10
    Rep Power
    0

    Default Re: Creating database connection in linux

    yes its single user application. so do i hav to install Derby on the pc which i am using in college? (sorry this might be a silly question but i am new to database programming)

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,442
    Rep Power
    18

    Default Re: Creating database connection in linux

    You'll need to distribute the Derby jar file with your application.
    The Derby docs provide pretty good explanation on how to set up an embedded database.
    All Derby will require (and this will be inside your code) is the location to put the database file(s) itself, which you can use System.getProperty("user.home"); (assuming I have the correct property there, of course). That will give you your users home directory, under which you can stick (somewhere) the directory for the database to use.

    Here's the basics for the embedded Derby tutorial.

  5. #5
    mangesh.gho is offline Member
    Join Date
    Jan 2012
    Posts
    10
    Rep Power
    0

    Default Re: Creating database connection in linux

    ok.. I'll do this thing.. Thank you very much..

Similar Threads

  1. Java Sqlite Connection in Linux
    By sridaran in forum JDBC
    Replies: 1
    Last Post: 02-07-2011, 07:20 PM
  2. connection to database
    By buston01 in forum JDBC
    Replies: 4
    Last Post: 02-21-2010, 01:32 AM
  3. Replies: 3
    Last Post: 01-21-2010, 01:51 AM
  4. getting database connection
    By ravidasineni in forum AWT / Swing
    Replies: 1
    Last Post: 11-22-2009, 02:01 AM
  5. Database Connection
    By vipinkumarsolanki in forum Advanced Java
    Replies: 2
    Last Post: 11-26-2007, 06:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •