Giter VIP home page Giter VIP logo

Comments (13)

akhilravuri1 avatar akhilravuri1 commented on July 17, 2024 1

Hi @tredoe

I don't know how oracle handles 'create database' query but in our db2 you have to call a new api to create the database, not the exec api.

You can check this documentation where we support create and drop database API's.
https://github.com/ibmdb/node-ibm_db/blob/master/APIDocumentation.md#createDbSyncApi

we have taken your request to support create and drop database api but it will be supported in the same way how node js supports.

Thanks,
Akhil

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on July 17, 2024

Hi @tredoe
Our driver is based on the go standard package database/sql.
As of now, database package does not support create a database (admin operation) so we cannot support it.

If go add's support for creating a database. we will also support that.

Thanks,
Akhil.

from go_ibm_db.

tredoe avatar tredoe commented on July 17, 2024

I can create databases using the package database/sql at other DBMSs like Mysql, PostgreSQL, MariaDB, and Microsoft SQL Server (it's that I've tested until now).

By now, only fails with IBM DB2. The next ones to testing are Oracle and Firebird. So it is not an issue related to the support at database/sql.

To create a database, there is to connect to the master database and then to send a statement like 'CREATE DATABASE [name]'.

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on July 17, 2024

I can create databases using the package database/sql at other DBMSs like Mysql, PostgreSQL, MariaDB, and Microsoft SQL Server (it's that I've tested until now)

Can you send me the GitHub links of these drivers?

from go_ibm_db.

tredoe avatar tredoe commented on July 17, 2024

MySQL/MariaDB: "github.com/go-sql-driver/mysql"
PostgreSQL: "github.com/lib/pq"
SQL Server: "github.com/denisenkom/go-mssqldb"

In fact, I could add the code where it shows how I create a database. MySQL or PostgreSQL?

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on July 17, 2024

Hi @tredoe
In IBM db2 to create a database, you have to disconnect from the database.
image

And in the go-driver, we can add that support if you are not connecting to the database.

Thanks,
Akhil

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on July 17, 2024

could you to add support to create and drop a database with db.Exec() API?

@tredoe we cannot add a create database with db.Exec() but we can try to add this support with a new api.
Sample:-

import 'github.com/ibmdb/go_ibm_db'
func main(){
//connection string without database name.
go_ibm_db.CreateDB('databasename', 'host=localhost;uid=uname;pass=password,port=40000')
}

from go_ibm_db.

tredoe avatar tredoe commented on July 17, 2024

It is not necessary to add a new API.

If the connection string has the key 'Database', then it connect to such DB, else it connects to the instance where we could send a statement like "CREATE DATABASE".

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on July 17, 2024

If the connection string has the key 'Database', then it connect to such DB, else it connects to the instance where we could send a statement like "CREATE DATABASE".

@tredoe
Are you talking about IBM DB?
Did you pass the connection string(like datbase, host, uid, port, pass) or dsn=name?

from go_ibm_db.

tredoe avatar tredoe commented on July 17, 2024

I'm talking about IBM DB2, and I used the string "Hostname=127.0.0.1;Protocol=tcpip;Port=50000;Database=%s;Uid=%s;Pwd=%s".

It was only an idea to not have to add a different API.

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on July 17, 2024

I'm talking about IBM DB2, and I used the string "Hostname=127.0.0.1;Protocol=tcpip;Port=50000;Database=%s;Uid=%s;Pwd=%s".

It was only an idea to not have to add a different API.

Our clidriver does not work in that way...It uses different api to create a database.

Create database is admin operation.

from go_ibm_db.

tredoe avatar tredoe commented on July 17, 2024

With Oracle there is also to use a command to create a database (sqlplus; db2 for IBM2), so there is no need to change the API on this driver. Those DBMSs work of that way and there is no need to change the API to be enable to create/drop a database.

Thanks anyway!

from go_ibm_db.

akhilravuri1 avatar akhilravuri1 commented on July 17, 2024

Hi @tredoe

Database creation support has been added. Please pull the latest code and use it.

Thanks,
Akhil

from go_ibm_db.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.