Creating a new access database using JDBC

Hi Forum,
I have a problem in hand. Let me describe the problem:
I want to create an "access database" from java at runtime. "Access database" is file based, so for a database named test, it will have a file test.mdb.
Now, everything's sweet and wonderful, if somebody creates an "empty access database" at the client machine and i then connect to it and create the tables i require.
But the issue is i want to create the database at runtime (the database name and tables are determined at runtime).
Using the JDBC:ODBC bridge driver , i am able to connect to an existing database, but any "create database" statements are not supported.
A last ditch solution would be that i create an empty database using access and copy the file contents in the SQL server database as a a blob object. Then when i want to create a new access database at runtime, i create a file in a particular folder , with an .mdb
extension, copy the file contents from the SQL server (i also have an SQL server connection) BLOB object, and then try to connect to the
.mdb file.
But this approach seems a "quick hack" and can have problems (which i can't see as of now).
Can you suggest a better alternative for the problem.
See the Java Sun forum at this address for a discussion of a similar problem, but sadly with no solution.
http://forum.java.sun.com/thread.jspa?forumID=31&threadID=484731

I have an applet that was previously connected to Oracle 9i. I am faced with connecting to MS Access temporarily for testing purposes.
I have been unable to successfully code connection in java. I have set up the DSN and can access in SQL Worksheet in JDev.
I saw your question regarding creating an access db, and thought you might be so kind as to help me code the connection to access!!!!
Any help you could provide would be greatly appreciated. I have a huge application to finish with alot of sqlj already completed. Connectivity is not my area of expertise!
Any help you could provide would be greatly appreciated!!!
I am not sure if I have to use bridge? Am I progressing in right direction to migrating to SQL Server if need be?

Similar Messages

  • Creating a new Oracle Database using 10G Grid Control

    Hi
    Is it possible to create a new database using the 10g Grid COntrol.

    The way to create a database with EM, is by using Provisioning procedures. For instance with the Oracle Clusterware / RAC Provisioning For UNIX, you can provisioning Clusterware, ASM + ASM instance creation and DB Software. Then by provisoning you would create a database. There are also procedures to extend a cluster.
    So, provisoning is the way to go!
    Regards
    Rob

  • Creating A New MySQL Database With Coldfusion Code

    Hi,
    I was wondering if anyone knew how to create a whole entire
    new database simply by executing a Coldfusion template (via a form
    for example).
    I'm pretty confident at creating a new table in an already
    existing database but not sure how to go about creating an entirely
    new database from pure ColdFusion code using MySQL.
    I basically want to create some portal for myself to do this
    to save on arduous time. It'll need to be a form because I'll have
    to give it a name, username, password etc. I need the seperate
    databases for my separate clients you see.
    One point I should make is that it is on a shared server so I
    don't have direct access to the CF Administrator.
    Any advice on achieving this or highlighting the pitfalls
    would be greatly appreciated.
    Many thanks in advance!
    Michael.

    quote:
    Originally posted by:
    Sabaidee
    if it is on a shared server, then you very likely do not have
    enough permissions to create new batabases in MySQL either...
    is there an option for you in your hosting control panel (or
    whatever it is called) to create a new MySQL database for your
    account without any involvement of server admins? if so then,
    technically you may be able to create a new db programmatically.
    but i doubt you can...
    I know it sounds cheeky but any chance you could supply
    example code for doing this with ColdFusion and MySQL? This way I
    will then be able to try it rather than waiting for my host to get
    back to me.
    I would have tried doing it already because I use SQL quite
    often with queries etc, but I just don't have the technical know
    how for this specific task at hand.
    Many thanks for your help!

  • Inserting Multiple Images into oracle database using JDBC

    I wanted to insert multiple images into database using JDBC by reading it from the file... and i am passing photos.txt(my text file) as an input parameter... I have inserted all the values into the database except for the image part... this is my content of photos.txt file and i have copied all the images into the folder
    *" C:\\photos "*
    *1,in1.jpg,108,19,in-n-out*
    *2,in2.jpg,187,21,in-n-out*
    *3,in3.jpg,308,41,in-n-out*
    *4,in4.jpg,477,52,in-n-out*
    *5,in5.jpg,530,50,in-n-out*
    and i want to store in1.jpg,in2.jpg,in3.jpg,in4.jpg,in5.jpg into the oracle databse using JDBC.... i have tried a lot using BLOB column.... and i have created my table as
    CREATE TABLE PHOTO(
    ID NUMBER NOT NULL PRIMARY KEY ,
    Name BLOB,
    X DOUBLE PRECISION,
    Y DOUBLE PRECISION,
    Tags VARCHAR2(40)
      try {                 // for restaurant System.out.println();System.out.println();System.out.println(); System.out.print("  Creating Statement for Photo...\n");             stmt2 = con.createStatement ();                       stmt2.executeUpdate("delete from PHOTO"); stmt2.executeUpdate("commit"); PreparedStatement stmt3 = con.prepareStatement ("INSERT INTO PHOTO VALUES (?, ?, ?, ?, ?)");             System.out.print("  Create FileReader Object for file: " + inputFileName1 + "...\n");             FileReader inputFileReader2 = new FileReader(inputFileName1);             System.out.print("  Create BufferedReader Object for FileReader Object...\n");             BufferedReader inputStream2  = new BufferedReader(inputFileReader2);             String inLine2 = null;                         String[] tokens; //            String[] imageFilenames = {"c:\\photos\\in1.jpg","c:\\photos\\in2.jpg","c:\\photos\\in3.jpg","c:\\photos\\in4.jpg","c:\\photos\\in5.jpg", //  "c:\\photos\\in6.jpg","c:\\photos\\in7.jpg","c:\\photos\\in8.jpg","c:\\photos\\in9.jpg","c:\\photos\\in10.jpg","c:\\photos\\arb1.jpg","c:\\photos\\arb2.jpg", //  "c:\\photos\\arb3.jpg","c:\\photos\\arb4.jpg","c:\\photos\\arb5.jpg","c:\\photos\\den1.jpg","c:\\photos\\den2.jpg","c:\\photos\\den3.jpg", //  "c:\\photos\\den4.jpg","c:\\photos\\den5.jpg","c:\\photos\\hop1.jpg","c:\\photos\\hop2.jpg","c:\\photos\\hop3.jpg","c:\\photos\\hop4.jpg","c:\\photos\\hop5.jpg"};               File file = new File("C:\\photos\\in1.jpg");            \\ ( Just for example  )           FileInputStream fs = new FileInputStream(file);                         while ((inLine2 = inputStream2.readLine()) != null) {               tokens= inLine2.split(",");             st2 = new StringTokenizer(inLine2, DELIM);                                                             stmt3.setString(1, tokens[0]);               stmt3.setBinaryStream(2, fs, (int)(file.length()));               stmt3.setString(3, tokens[2]);               stmt3.setString(4, tokens[3]);               stmt3.setString(5, tokens[4]);               stmt3.execute(); //execute the prepared statement               stmt3.clearParameters(); 
    As i am able to enter one image file by above code in1.jpg in to the oracle database.... but i am not able to insert all the image file in to the database.....do tell me what should i do.... and can you give me the example on the basis of the above code of mine...
    do reply as soon as possible..

    jwenting wrote:
    that depends. Putting the images in BLOBs prevents the file locations stored in the database from getting out of synch with the filesystem when sysadmins decide to reorganise directory structures or "archive" "old" files that noone uses anyway.True, but it really comes down to a business decision (cost-benefit analysis). If you have the bucks, the expertise, and the time, go with the Blobs, otherwise go with the flat files.

  • Integrate 300 MS Access Databases using ODI

    Hi All,
    I am trying to integrate data between 300 similar MS Access databases using ODI. All the source databases have exactly the same data structures. I have done a POC for 3 databases by creating interfaces and could integrate the data between them successfully.
    Now that the project is approved ; Going forward I need to integrate data from 297 MS Access databases, so I need to run the same set of Interfaces on 297 source MS Access Databases with Target DB being the same.
    This integartion work could be labourious as I need to copy 7 interfaces on 297 databases - IS THERE ANY EASY SOLUTION FOR THIS PROBLEM.
    Some one suggested me to use Dynamic Variables in the TOPOLOGY to access all the MS Access databases - BUT NOT SURE IF THAT WORKS.
    APPRECIATE your suggestions.
    Thanks & Regards
    Kay

    The issue you face here is that the Access database is connected to through the JDBC-ODBC bridge to the Access ODBC database driver. You will need to have a separate DSN defined for each of the access databases, if you want to address each individually.
    An alternative approach is to have one DSN set up, one entry in ODI's topology, one interface etc, and each file you wish to use, you rename to a given name first. Thus, when ODI tries to access the database, the ODBC driver finds the then current file. Note that ODI keeps the database connection for the duration of a SESSION, so if you wanted to process all 300 files sequentially, then you would need to run separate sessions for each of the file executions.
    I think this will give you the solution you require without resorting to variables.

  • How can I create a new entry without using LOV for foreign keys.

    Referring to TUHRA sample application based on HR database schema. JDeveloper 10.1.3.0.4
    How can I create a new employee without using LOV for the foreign key "job_id".
    On the first page I would like to choose the job_title from adf read-only table.
    After clicking on the "create new employee button" a creation form appears in which the job_id field is set with previous selection.
    Regards M.Winkler
    Edited by: user3541283 on 06.10.2008 03:44
    Edited by: user3541283 on 06.10.2008 03:50

    Hi,
    usually the foreign key is only set if the VO you select is dependent from a master. If e.g. you have DepartmentsVO1 that has an EmployeeVO3 as its nested VO, then creating a new instance of employees automatically add the foreign key. If you add EmployeesVO1, which is not dependent to DepartmensVO1, then the foreign key is not set. So if this is the case in THURA (keep in mind that this is not an Oracle demo but a sample used in a book about ADF) then all you need is to take the independent VO when building the new employee form.
    Frank

  • Create a new oracle database from OCI or OCCI client

    Hi,
    How can we create a new oracle database from OCI or OCCI client?
    i am using the oracle 11gR2
    Thanks in Advance,
    Sreekanth Polaka

    Though I have not tried creating a database, try if its doable.
    You can use OCI to perform SYSDBA operations.
    So connect as OCI_SYSDBA and try executing the entire create database command.

  • Can i create a ms-access database (very urgent)

    hi folks
    i really need help in creating a ms-access database, i searched the forums but i couldnot find any answers.
    i really appreciate if anyone can tell how to create a ms-access database

    hi folks
    i really need help in creating a ms-access database, i
    searched the forums but i couldnot find any answers.
    i really appreciate if anyone can tell how to create a
    ms-access databaseIn java, the actual mdb file? You can't.
    The best you can do is create an empty mdb file and copy each time you need to create a new one.

  • Connection error to 9i database using JDBC thin driver

    When trying to connect to a new 9i database using the JDBC thin driver, I received the following error:
    java.sql.SQLException: ORA-00600: internal error code, arguments: [ttcgcshnd-1], [0], [], [], [], [], [], []
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java)
    at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java)
    at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java)
    at oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java)
    at oracle.jdbc.driver.OracleDatabaseMetaData.getTables(OracleDatabaseMetaData.java)
    I have no problem with my code connecting to an Oracle 8 database, just 9i.
    I'm trying to debug in Visual Cafe (JDK 1.1.7) and have both the classes111.zip and the nls_charset11.zip in my CLASSPATH.
    Any suggestions would be appreciated. Thanks

    If you're using 8i 8.1.7.1 or 8i 8.1.7.0 thin JDBC drivers on NT, then you can get them to connect to 9i by applying the 8i 8.1.7.1 Patch available at:
    http://technet.oracle.com/software/tech/java/sqlj_jdbc/htdocs/solsoft.html
    You might have to register/login first.
    Basically, it's just a case of replacing a class already in your classes111.zip or classes12.zip with the class in the patch.
    Took me a while to find this, but it worked first time after patching. Hope this helps.

  • Exchange 2010 - Create a new Mailbox Database

    Hello all and thanks in advance for your time and expertise.
    Here's my scenario:
    In my ORG we have one exchange server.  The hard drive space on this server was quite low so we added two more drives which are independent and in their own Raid Configuration from the drives that were already installed.  In other words, the current
    mailbox database is housed on drives with a total storage capacity of 837GB. 
    We recently added two more drives, each 2TB, and configured them in a RAID1. 
    I'm going to create a new Mailbox Database on the 2TB drives and move over some mailboxes to balance out the storage. 
    Question one:  When we move some of the mailboxes over to the new database - will this free up space on the existing database or do we have to reclaim it such as with an offline degrag.
    Question two:  When I create the new mailbox database and I'm prompted to Enter the new file locations for the database (database path and log folder path) - do I just change the paths to the new drive letter path such as G:
    We're eventually going to Office365 (hopefully sooner rather than later) but I just want to make sure I handle this process correctly. Your input here is greatly appreciated.

    Hello,
    Your databse size is 650 GB.  As per my experience , it would not take more than 14 hours for total mailbox movement.
    You will be creating new database of 2 TB , you have already allocated 2 Tb drive to exchange server.
    If you are dividing drive into 2 or four part and creating that much databse, it will be helpful for maintence activity in future.
    It is recommended that you move mailbox during off bussiness hours, it will fasten the movment,as there will be no load on exchange server . You can do it on daily basis Or you can do it on weekend .
    You need to take care of logs generated during movment, are you going to  use seperate log drive for databse, or combine with database drive. If you are moving all mailbox to one database, It will genrate same size of logs file as of total mailboxes
    size (650 GB). You neeed to handle it properly. Enable circular logging on database, after movment ,you can disable it.
    Moreover, if you will create move request of all mailboxes, exchange will process nly 50 request, rest will be in queue state.
    Regarding public folders, I understand there is no seperate disk for public folders, if you planning to delete old dtabse and free up disk space, you will have to move this public folders database to new disk also.
    Would recommend that you take advice  from other expert in this forum, before implementation.

  • Setting System DSN for MS Access Database using Java Code

    How to set the system DSN for Access database using Java Code at runtime....???
    Replies are deeply appreciated...

    I found a 3rd Party MS Access JDBC Driver from a Google search. I downloaded and tried the free trial version. It worked fine but we opted not to purchase the full version and went a different route. If you don't find it, let me know and I'll see if I can track down the name of the product we tested.

  • How do I open a pdf stored in a Microsoft Access database using Visual Basic studios 2012

    Currently I am unable to find a valid method of being able to open a pdf stored in a Microsoft Access database using Visual Basic studios 2012. I've tried displaying the entire database on a form, but when I do this all the other columns show up with
    the correct data besides the one containing the pdf's, it just displays <binary data> in each row down the column. I also tried another method with which you use the database as a dataset and can drag and drop the rows and columns into the form, which
    again works for all the other columns besides the one containing the pdf's but this time I'm unable to interact with the column  at all. 
    Not too sure if this is in the correct place, but any answers or help would be appreciated. Cheers.

    Alex,
    This forum is dedicated to Project and Project Server. You might get better response, if you post to a Visual Basic forum. Here are couple I could find. 
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral%2Cvblanguage&filter=alltypes&sort=lastpostdesc
    Cheers,
    Prasanna Adavi, Project MVP
    Blog:
      Podcast:
       Twitter:   
    LinkedIn:
      

  • How can I create accurate decimal dimensions when creating a new document or using the art board in Illustrator CS6? When I type in a number with a decimal, it automatically rounds the number up.

    How can I create accurate decimal dimensions when creating a new document or using the art board in Illustrator CS6? When I type in a number with a decimal, it automatically rounds the number up.

    For my part you are welcome, sdowers.
    Unfortunately, the uncertainty arising from the rounding has been up several times here in this forum.
    I just came to remember a warning that needs to be given:
    The rounding of the representation of a numerical value may be harmless in itself, but if you use it for any operation that changes the value, such as multiplication or whatever, things will go wrong because the operation will be made on the basis of the rounded value instead of the true value. So, as in your first case in post #2, 39.625 rounded to 39.63 will become 79.26 instead of 79.25.

  • Problems creating a new folder when using webmail

    Hi, has anyone else out there encountered problems when trying to create a new folder when using webmail ?
    It just seems to create a new folder called 'New Folder' and misses out the step that would normally allow you to rename it to a title of your choice.
    A whole list of folders called 'New Folder' is about as useful as an ashtray on a motorbike.
    It did used to work as I've used it many times in the past.....but then so did a lot of things before the 'new' and 'improved' version of BT Mail came along.
    Any help or suggestions gratefully received (apart from the obvious solution, switch to a mail client).
    Maybe it needs flagging to the 'techies'......they must be really busy trying to sort out all the so called teething problems.
    Solved!
    Go to Solution.

    What should happen is that when you click on the + for add a new folder a box should appear, somewhere amongst the folder list. (The list is in alphabetical order so if you have a number of folders previous to the letter N it maybe out of view ) .
    The box will have the text " New folder-X," ( see below for the explantion for the -X ) you then delete the text, type in the name you want, hit enter and there it is.
    If you don't notice the box, possibly because it's off screen further down the list, you then open and close the list, or log out the next time you view the list it, or they, are simply named New folder.
    So you now have umpteen " New folders ", here's how to rename them.
    Place your cursor on the word New Folder in your folder list, you will see a little box appear with" New folder-X,"  x being the number of the new folders you have created., eg -0, -1, -2 etc.
    Then double click on it, you should then get a larger box with New folder-X.
    Delete the text in the box, type in the name you want for the new folder, hit enter there's you newly named folder.

  • Oracle 10g - Creating a new Application Server using standalone OC4J 10g

    I have some issues in creating a new app. server using standalone oc4j 10g 10.1.3 instance. After I created the app. server instance, I tested the connection and it says connection refused. I used the userid as oc4jadmin and the password as welcome. I am getting a message connection refused. For connection, I used the default hostname "localhost" and I didn't mention anything in the URL path.

    Thanks Steve..
    Here is what I am trying to do.. I want to create a new app server instance (i.e.) stand alone oc4j server, where I can deploy my web service and run a test.
    Oracle JDeveloper 10g:
    Under Connection Navigator, Application Server --
    1) Right click to 'Create New Application Server Connection'
    2) Connection type as 'Standalone OC4J 10 g 10.1.3',
    3) Username ==> oc4jadmin, Password ==>welcome, checked the Deploy password.
    4) Hostname: localhost RMI Port: 23791
    URL path: <<blank>>
    5) Test Connection ==> getting a error message...
    Error while getting remote MBeanServer for url: ormi://localhost:23791/default:
    Error reading application-client descriptor: Error communicating with server: Connection refused: connect; nested exception is:
         javax.naming.CommunicationException: Connection refused: connect [Root exception is java.net.ConnectException: Connection refused: connect]
    Any input you can provide would be of great help.

Maybe you are looking for